Skip to content

Commit 8b87e00

Browse files
committed
Reformat command decorators for PyCord use
1 parent 5130ca4 commit 8b87e00

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

main.py

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,27 +203,42 @@ async def on_message(message):
203203
await client.process_commands(message)
204204

205205
# Commands
206-
@client.command()
206+
@client.slash_command(
207+
name="uptime",
208+
description="See the bot's current session uptime."
209+
)
207210
async def uptime(ctx: ApplicationContext):
208211
uptime = str(datetime.timedelta(seconds=int(round(time.time()-startTime))))
209212
await ctx.send(f'This session has been running for **{uptime}**')
210213

211-
@client.command(aliases=['commands'])
214+
@client.slash_command(
215+
name="help",
216+
description="Need help?"
217+
)
212218
async def help(ctx: ApplicationContext):
213219
emb = discord.Embed(title=f'increment.io Commands', description=f'I am a counting bot who looks for numbers and makes sure that the count doesn\'t get messed up. If you want help on commands or want a more organized view, check https://notsniped.github.io/increment.io/commands\n :warning: This bot is still WIP. Some commands/features may not work as expected.\n\n**Prefix:** ```Main Prefix: +```\n**Information:** ```+help, +ping, +stats, +serverstats,+credits```\n**Counting:** ```+setchannel, +numberonly [on/off], +reactions [on/off], +setnumber [number], +resetcount```', color=theme_color)
214220
await ctx.send(embed = emb)
215221

216-
@client.command(aliases=['pong'])
222+
@client.slash_command(
223+
name="ping",
224+
description="View the bot latency (in ms)"
225+
)
217226
async def ping(ctx: ApplicationContext):
218227
await ctx.send(f':ping_pong: Pong! In **{round(client.latency * 1000)}ms**.')
219228

220-
@client.command()
229+
@client.slash_command(
230+
name="credits",
231+
description="View the people behind this bot's development."
232+
)
221233
async def credits(ctx: ApplicationContext):
222234
emb = discord.Embed(title='Bot Credits', description='Owner: <@!738290097170153472>\nHelpers: <@!706697300872921088>, <@!705462972415213588>',color=theme_color)
223235
emb.set_footer(text='increment.io >> https://notsniped.github.io/increment.io')
224236
await ctx.send(embed=emb)
225237

226-
@client.command()
238+
@client.slash_command(
239+
name="serverstats",
240+
description="View counting stats for this server."
241+
)
227242
async def serverstats(ctx: ApplicationContext):
228243
servericon = ctx.guild.icon_url
229244
setchannelstats = countchannel[str(ctx.guild.id)]
@@ -235,7 +250,10 @@ async def serverstats(ctx: ApplicationContext):
235250
await ctx.send(embed = emb12)
236251

237252
# Count Commands
238-
@client.command()
253+
@client.slash_command(
254+
name="setchannel",
255+
description="Sets this channel as the server's counting channel."
256+
)
239257
@commands.has_permissions(administrator = True)
240258
async def setchannel(ctx: ApplicationContext):
241259
try:
@@ -244,7 +262,10 @@ async def setchannel(ctx: ApplicationContext):
244262
await ctx.send(f':white_check_mark: <#{channel_to_set}> set as counting channel.')
245263
except: await ctx.send(':x: Unable to set count channel. Try again later.')
246264

247-
@client.command()
265+
@client.slash_command(
266+
name="reactions",
267+
description="Choose whether you want bot reactions enabled or not."
268+
)
248269
@commands.has_permissions(administrator = True)
249270
async def reactions(ctx: ApplicationContext, setting: str):
250271
if setting == 'on':
@@ -261,15 +282,21 @@ async def reactions(ctx: ApplicationContext, setting: str):
261282
await ctx.send(f':white_check_mark: Turned **off** count reactions.')
262283
else: await ctx.send(f'\'{setting}\' is not a valid option. You can choose between `on` and `off`')
263284

264-
@client.command(aliases=['setnum'])
285+
@client.slash_command(
286+
name="setnumber",
287+
description="Set the current count to a new value."
288+
)
265289
async def setnumber(ctx: ApplicationContext, arg1: int):
266290
if arg1 < 1: raise(discord.ext.commands.BadArgument)
267291
else:
268292
count[str(ctx.channel.id)] = arg1
269293
savedata()
270294
await ctx.reply(f':white_check_mark: Count set to `{count[str(ctx.channel.id)]}`')
271295

272-
@client.command(aliases=['resetnumber', 'reset', 'resetnum'])
296+
@client.slash_command(
297+
name="resetcount",
298+
description="Reset the current count."
299+
)
273300
async def resetcount(ctx):
274301
count[str(ctx.channel.id)] = 1
275302
savedata()

0 commit comments

Comments
 (0)