Skip to content

Commit b383f43

Browse files
committed
Slash cmd for say and a few bits I forgot when merging
1 parent 49c0674 commit b383f43

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

cogs/channel_checker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,5 @@ def __init__(self, bot: Bot):
8686
self.bot.loop.create_task(channel_check(self.bot))
8787

8888

89-
def setup(bot: Bot):
90-
bot.add_cog(ChannelChecker(bot))
89+
async def setup(bot: Bot):
90+
await bot.add_cog(ChannelChecker(bot))

cogs/commands/roomsearch.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ def __init__(self, bot: Bot):
4747
self.year = None
4848
self.week = None
4949

50-
@commands.command()
50+
@commands.hybrid_command()
5151
async def roompr(self, ctx: Context):
5252
await ctx.reply(
5353
"This bot uses the Campus Map's API (<https://campus.warwick.ac.uk/>)."
5454
"If a name is wrong/missing on there, either ask exec to add it, "
5555
"or create a PR to add an alias in `resources/rooms/room-mapname.json`"
5656
)
5757

58-
@commands.command()
58+
@commands.hybrid_command()
5959
async def room(self, ctx: Context, *, name: str):
6060
"""Warwick Room Search
6161
@@ -228,5 +228,5 @@ def is_central(self, room_name):
228228
return None
229229

230230

231-
def setup(bot: Bot):
232-
bot.add_cog(RoomSearch(bot))
231+
async def setup(bot: Bot):
232+
await bot.add_cog(RoomSearch(bot))

cogs/commands/say.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import discord
2+
from discord import app_commands
13
from discord.ext import commands
24
from discord.ext.commands import Bot, Context, clean_content
35

@@ -12,6 +14,10 @@ class Say(commands.Cog):
1214
def __init__(self, bot: Bot):
1315
self.bot = bot
1416

17+
@app_commands.command(name="say", description=SHORT_HELP_TEXT)
18+
async def say_slash(self, int: discord.Interaction, message: str):
19+
await int.response.send_message(discord.utils.escape_mentions(message))
20+
1521
@commands.command(help=LONG_HELP_TEXT, brief=SHORT_HELP_TEXT)
1622
async def say(self, ctx: Context, *message: clean_content):
1723
await ctx.send(" ".join([x.lstrip("@") for x in message]))

0 commit comments

Comments
 (0)