Skip to content

Commit 76a903c

Browse files
fix: provide a discord.Member object instead of string to slash commands (#273)
1 parent 389d41a commit 76a903c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/discord_bot.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ async def on_ready():
5353

5454
bot.add_view(DonateCommandView()) # register view for persistent listening
5555

56+
# try to force sync commands
57+
# calling an outdated command seems to force a sync
58+
await bot.sync_commands(
59+
commands=bot.commands,
60+
force=True,
61+
)
62+
5663
try:
5764
os.environ['DAILY_TASKS']
5865
except KeyError:
@@ -181,7 +188,7 @@ async def channel(ctx: discord.ApplicationContext,
181188
)
182189
async def donate_command(ctx: discord.ApplicationContext,
183190
user: Option(
184-
input_type=discord.Member,
191+
discord.Member,
185192
description=user_mention_desc,
186193
required=False)
187194
):
@@ -210,7 +217,7 @@ async def donate_command(ctx: discord.ApplicationContext,
210217
)
211218
async def random_command(ctx: discord.ApplicationContext,
212219
user: Option(
213-
input_type=discord.Member,
220+
discord.Member,
214221
description=user_mention_desc,
215222
required=False)
216223
):
@@ -258,7 +265,7 @@ async def random_command(ctx: discord.ApplicationContext,
258265
)
259266
async def docs_command(ctx: discord.ApplicationContext,
260267
user: Option(
261-
input_type=discord.Member,
268+
discord.Member,
262269
description=user_mention_desc,
263270
required=False)
264271
):
@@ -300,7 +307,7 @@ async def docs_command(ctx: discord.ApplicationContext,
300307
)
301308
async def refund_command(ctx: discord.ApplicationContext,
302309
user: Option(
303-
input_type=discord.Member,
310+
discord.Member,
304311
description=user_mention_desc,
305312
required=False)
306313
):

0 commit comments

Comments
 (0)