Skip to content

Commit fab3f7b

Browse files
committed
rename status to activity
Status can be later used for online/idle/busy as per discord rewrite convention
1 parent ef21073 commit fab3f7b

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

cogs/utility.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -267,40 +267,59 @@ async def update(self, ctx):
267267
else:
268268
em.description = 'Already up to date with master repository.'
269269

270-
271270
await ctx.send(embed=em)
272271

273272
@commands.command(aliases=['presence'])
274273
@commands.has_permissions(administrator=True)
275-
async def status(self, ctx, activity_type: str, *, message: str = ''):
274+
async def activity(self, ctx, activity_type: str, *, message: str = ''):
276275
"""
277-
Set a custom playing status for the bot.
276+
Set a custom activity for the bot.
278277
279-
[prefix]status activity message...
278+
Possible activity types: `playing`, `streaming`, `listening`, `watching`, `clear`
280279
281-
Set the message to `clear` if you want to remove the status.
280+
When activity type is set to `clear`, the current activity is removed.
282281
"""
283282
if activity_type == 'clear':
284283
await self.bot.change_presence(activity=None)
285284
self.bot.config['activity_type'] = None
286285
self.bot.config['activity_message'] = None
287286
await self.bot.config.update()
288-
return
287+
em = discord.Embed(
288+
title='Activity Removed',
289+
color=discord.Color.green()
290+
)
291+
return await ctx.send(embed=em)
292+
293+
if not message:
294+
em = discord.Embed(
295+
title='Invalid Message',
296+
description='You must set an activity message.',
297+
color=discord.Color.red()
298+
)
299+
return await ctx.send(embed=em)
300+
301+
try:
302+
activity_type = ActivityType[activity_type]
303+
except KeyError:
304+
em = discord.Embed(
305+
title='Invalid Activity Type',
306+
description=f'Cannot set activity to: {activity_type}.',
307+
color=discord.Color.red()
308+
)
309+
return await ctx.send(embed=em)
289310

290-
activity_type = ActivityType[activity_type]
291-
self.bot: commands.Bot
292311
activity = discord.Activity(type=activity_type, name=message)
293312
await self.bot.change_presence(activity=activity)
294313
self.bot.config['activity_type'] = activity_type
295314
self.bot.config['activity_message'] = message
296315
await self.bot.config.update()
297316

298317
em = discord.Embed(
299-
title='Status Changed',
300-
description=f'{ActivityType(activity_type)}: {message}.',
318+
title='Activity Changed',
319+
description=f'Current activity is: {activity_type.name} {message}.',
301320
color=discord.Color.green()
302321
)
303-
await ctx.send(embed=em)
322+
return await ctx.send(embed=em)
304323

305324
@commands.command()
306325
@trigger_typing

0 commit comments

Comments
 (0)