Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions src/discord_bot/cogs/fun_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# local imports
from src.common.common import avatar, bot_name, colors
from src.discord_bot.views import RefundCommandView
from src.discord_bot import cogs_common


Expand Down Expand Up @@ -70,41 +69,6 @@ async def random_command(
else:
await ctx.respond(embed=embed)

@discord.slash_command(
name="refund",
description="Get refund form"
)
async def refund_command(
self,
ctx: discord.ApplicationContext,
user: Option(
discord.Member,
description=cogs_common.user_mention_desc,
required=False,
),
):
"""
Sends a discord embed, with a `Modal`.
This command is pure satire.

Parameters
----------
ctx : discord.ApplicationContext
Request message context.
user : discord.Member
Username to mention in response.
"""
embed = discord.Embed(title="Refund request",
description="Original purchase price: $0.00\n\n"
"Select the button below to request a full refund!",
color=colors['red'])
embed.set_footer(text=bot_name, icon_url=avatar)

if user:
await ctx.respond(user.mention, embed=embed, view=RefundCommandView())
else:
await ctx.respond(embed=embed, view=RefundCommandView())


def setup(bot: discord.Bot):
bot.add_cog(FunCommandsCog(bot=bot))
21 changes: 0 additions & 21 deletions src/discord_bot/modals.py

This file was deleted.

14 changes: 0 additions & 14 deletions src/discord_bot/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
# lib imports
import discord
from discord.ui.select import Select
from discord.ui.button import Button

# local imports
from src.common.common import avatar, bot_name, colors
from src.discord_bot.helpers import get_json
from src.discord_bot.modals import RefundModal


class DocsCommandDefaultProjects:
Expand Down Expand Up @@ -305,15 +303,3 @@ def __init__(self):
)

self.add_item(button)


class RefundCommandView(discord.ui.View):
"""
Class representing `discord.ui.View` for ``refund`` slash command.
"""
def __init__(self):
super().__init__(timeout=None) # timeout of the view must be set to None, view is persistent

@discord.ui.button(label="Refund form", style=discord.ButtonStyle.red, custom_id='button-refund')
async def button_callback(self, button: Button, interaction: discord.Interaction):
await interaction.response.send_modal(RefundModal(title="Refund Request Form"))