Skip to content

Commit

Permalink
Merge pull request #4 from Charlie999/link-command-dev
Browse files Browse the repository at this point in the history
Add /pub link command and appropriate config entry
  • Loading branch information
trickeydan authored Dec 5, 2024
2 parents dbbfcb6 + 8b9ed8a commit eae7f01
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example-config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ emoji_reacts = "🚂😠🚇"
weekday = 3 # Thursday
hour = 20
channel_id = 1234567890
description = "Casual chat and food. All welcome."
description = "Casual chat and food. All welcome."
web_url = "https://example.com/"
1 change: 1 addition & 0 deletions kmibot/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class PubConfig(BaseModel):
weekday: int
hour: int
minute: int = 0
web_url: str


class FerryConfig(BaseModel):
Expand Down
10 changes: 10 additions & 0 deletions kmibot/modules/pub/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,17 @@ async def help(self, interaction: discord.Interaction) -> None: # noqa: A003
"/pub table <table_no> - 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, ephemeral=True
)

0 comments on commit eae7f01

Please sign in to comment.