From bf744a7c0fe3aa474825fcd1297b4ea3a32726f3 Mon Sep 17 00:00:00 2001 From: Charlie Date: Thu, 5 Dec 2024 13:52:57 +0000 Subject: [PATCH 1/3] add /pub link command and appropriate config entry --- example-config.toml | 3 ++- kmibot/config.py | 2 +- kmibot/modules/pub/commands.py | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/example-config.toml b/example-config.toml index d1a58ed..e68c608 100644 --- a/example-config.toml +++ b/example-config.toml @@ -14,4 +14,5 @@ emoji_reacts = "🚂😠🚇" weekday = 3 # Thursday hour = 20 channel_id = 1234567890 -description = "Casual chat and food. All welcome." \ No newline at end of file +description = "Casual chat and food. All welcome." +web_url = "https://example.com/" \ No newline at end of file diff --git a/kmibot/config.py b/kmibot/config.py index 5871b5d..570272d 100644 --- a/kmibot/config.py +++ b/kmibot/config.py @@ -22,7 +22,7 @@ class PubConfig(BaseModel): weekday: int hour: int minute: int = 0 - + web_url: str class FerryConfig(BaseModel): api_url: str diff --git a/kmibot/modules/pub/commands.py b/kmibot/modules/pub/commands.py index 8aa4582..55b5e88 100644 --- a/kmibot/modules/pub/commands.py +++ b/kmibot/modules/pub/commands.py @@ -365,7 +365,18 @@ async def help(self, interaction: discord.Interaction) -> None: # noqa: A003 "/pub table - add the table number and let others know", "/pub attendees - get the people coming to the next pub, including AutoPub attendees", "/pub change - move the location of the pub and ping all attendees.", + "/pub link - get a link to the website" ], ), ephemeral=True, ) + + @command(description="Get a link to the web service") # type: ignore[arg-type] + async def link(self, interaction: discord.Interaction) -> None: #noqa: A003 + LOGGER.info(f"{interaction.user} used /pub link") + assert interaction.guild is not None + + await interaction.response.send_message( + "Here you go:\n"+self.config.pub.web_url, + epheremal=True + ) From 47e839a2dc9911ac55ba199f817f3753be165e20 Mon Sep 17 00:00:00 2001 From: Charlie Date: Thu, 5 Dec 2024 14:01:19 +0000 Subject: [PATCH 2/3] do inexplicable poetry things --- kmibot/config.py | 1 + kmibot/modules/pub/commands.py | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kmibot/config.py b/kmibot/config.py index 570272d..d646d88 100644 --- a/kmibot/config.py +++ b/kmibot/config.py @@ -24,6 +24,7 @@ class PubConfig(BaseModel): minute: int = 0 web_url: str + class FerryConfig(BaseModel): api_url: str api_key: str diff --git a/kmibot/modules/pub/commands.py b/kmibot/modules/pub/commands.py index 55b5e88..fd7bbc3 100644 --- a/kmibot/modules/pub/commands.py +++ b/kmibot/modules/pub/commands.py @@ -365,18 +365,17 @@ async def help(self, interaction: discord.Interaction) -> None: # noqa: A003 "/pub table - add the table number and let others know", "/pub attendees - get the people coming to the next pub, including AutoPub attendees", "/pub change - move the location of the pub and ping all attendees.", - "/pub link - get a link to the website" + "/pub link - get a link to the website", ], ), ephemeral=True, ) - @command(description="Get a link to the web service") # type: ignore[arg-type] - async def link(self, interaction: discord.Interaction) -> None: #noqa: A003 + @command(description="Get a link to the web service") # type: ignore[arg-type] + async def link(self, interaction: discord.Interaction) -> None: # noqa: A003 LOGGER.info(f"{interaction.user} used /pub link") assert interaction.guild is not None await interaction.response.send_message( - "Here you go:\n"+self.config.pub.web_url, - epheremal=True + "Here you go:\n" + self.config.pub.web_url, epheremal=True ) From 8b9ed8ae9ce9d0597f012afac682a0a02532c8bf Mon Sep 17 00:00:00 2001 From: Charlie Date: Thu, 5 Dec 2024 14:02:42 +0000 Subject: [PATCH 3/3] fix typo --- kmibot/modules/pub/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kmibot/modules/pub/commands.py b/kmibot/modules/pub/commands.py index fd7bbc3..3783387 100644 --- a/kmibot/modules/pub/commands.py +++ b/kmibot/modules/pub/commands.py @@ -377,5 +377,5 @@ async def link(self, interaction: discord.Interaction) -> None: # noqa: A003 assert interaction.guild is not None await interaction.response.send_message( - "Here you go:\n" + self.config.pub.web_url, epheremal=True + "Here you go:\n" + self.config.pub.web_url, ephemeral=True )