Skip to content

Commit 4dfc473

Browse files
committed
Add new decorators for options
1 parent 8b87e00 commit 4dfc473

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

main.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,16 @@ async def setchannel(ctx: ApplicationContext):
266266
name="reactions",
267267
description="Choose whether you want bot reactions enabled or not."
268268
)
269+
@option(name="value", description="Choose a setting value", type=str, choices=["on", "off"])
269270
@commands.has_permissions(administrator = True)
270-
async def reactions(ctx: ApplicationContext, setting: str):
271-
if setting == 'on':
271+
async def reactions(ctx: ApplicationContext, value: str):
272+
if value == 'on':
272273
if autoreactions[str(ctx.guild.id)] == 1: await ctx.send(':warning: This feature is already enabled.')
273274
else:
274275
autoreactions[str(ctx.guild.id)] = 1
275276
savedata()
276277
await ctx.send(f':white_check_mark: Turned **on** count reactions.')
277-
elif setting == 'off':
278+
elif value == 'off':
278279
if autoreactions[str(ctx.guild.id)] == 0: await ctx.send(':warning: This feature is already disabled')
279280
else:
280281
autoreactions[str(ctx.guild.id)] = 0
@@ -286,10 +287,11 @@ async def reactions(ctx: ApplicationContext, setting: str):
286287
name="setnumber",
287288
description="Set the current count to a new value."
288289
)
289-
async def setnumber(ctx: ApplicationContext, arg1: int):
290-
if arg1 < 1: raise(discord.ext.commands.BadArgument)
290+
@option(name="new_count", description="What do you want to set the count to?", type=int)
291+
async def setnumber(ctx: ApplicationContext, new_count: int):
292+
if new_count < 1: raise(discord.ext.commands.BadArgument)
291293
else:
292-
count[str(ctx.channel.id)] = arg1
294+
count[str(ctx.channel.id)] = new_count
293295
savedata()
294296
await ctx.reply(f':white_check_mark: Count set to `{count[str(ctx.channel.id)]}`')
295297

0 commit comments

Comments
 (0)