aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/utilities/epoch.py
diff options
context:
space:
mode:
authorGravatar Xithrius <[email protected]>2022-11-02 02:07:29 -0700
committerGravatar GitHub <[email protected]>2022-11-02 02:07:29 -0700
commit43a2acf5ee4eb354ce3dfaeef9504eee9b9b46b4 (patch)
treecbdfeb08f8d582aa98acec6a529f0fa3dcd7933c /bot/exts/utilities/epoch.py
parentAppeased the formatter (diff)
parentMerge pull request #1137 from DivyanshuBist/bug-issue1122-message-of-type-None (diff)
Merge branch 'main' into main
Diffstat (limited to 'bot/exts/utilities/epoch.py')
-rw-r--r--bot/exts/utilities/epoch.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/bot/exts/utilities/epoch.py b/bot/exts/utilities/epoch.py
index 42312dd1..6f572640 100644
--- a/bot/exts/utilities/epoch.py
+++ b/bot/exts/utilities/epoch.py
@@ -6,7 +6,6 @@ from dateutil import parser
from discord.ext import commands
from bot.bot import Bot
-from bot.utils.extensions import invoke_help_command
# https://discord.com/developers/docs/reference#message-formatting-timestamp-styles
STYLES = {
@@ -48,6 +47,9 @@ class DateString(commands.Converter):
class Epoch(commands.Cog):
"""Convert an entered time and date to a unix timestamp."""
+ def __init__(self, bot: Bot) -> None:
+ self.bot = bot
+
@commands.command(name="epoch")
async def epoch(self, ctx: commands.Context, *, date_time: DateString = None) -> None:
"""
@@ -71,7 +73,7 @@ class Epoch(commands.Cog):
Times in the dropdown are shown in UTC
"""
if not date_time:
- await invoke_help_command(ctx)
+ await self.bot.invoke_help_command(ctx)
return
if isinstance(date_time, tuple):
@@ -117,7 +119,7 @@ class TimestampMenuView(discord.ui.View):
self.dropdown.add_option(label=label, description=date_time)
@discord.ui.select(placeholder="Select the format of your timestamp")
- async def select_format(self, _: discord.ui.Select, interaction: discord.Interaction) -> discord.Message:
+ async def select_format(self, interaction: discord.Interaction, _: discord.ui.Select) -> discord.Message:
"""Drop down menu which contains a list of formats which discord timestamps can take."""
selected = interaction.data["values"][0]
if selected == "Epoch":
@@ -133,6 +135,6 @@ class TimestampMenuView(discord.ui.View):
return True
-def setup(bot: Bot) -> None:
+async def setup(bot: Bot) -> None:
"""Load the Epoch cog."""
- bot.add_cog(Epoch())
+ await bot.add_cog(Epoch(bot))