@@ -267,40 +267,59 @@ async def update(self, ctx):
267
267
else :
268
268
em .description = 'Already up to date with master repository.'
269
269
270
-
271
270
await ctx .send (embed = em )
272
271
273
272
@commands .command (aliases = ['presence' ])
274
273
@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 = '' ):
276
275
"""
277
- Set a custom playing status for the bot.
276
+ Set a custom activity for the bot.
278
277
279
- [prefix]status activity message...
278
+ Possible activity types: `playing`, `streaming`, `listening`, `watching`, `clear`
280
279
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 .
282
281
"""
283
282
if activity_type == 'clear' :
284
283
await self .bot .change_presence (activity = None )
285
284
self .bot .config ['activity_type' ] = None
286
285
self .bot .config ['activity_message' ] = None
287
286
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 )
289
310
290
- activity_type = ActivityType [activity_type ]
291
- self .bot : commands .Bot
292
311
activity = discord .Activity (type = activity_type , name = message )
293
312
await self .bot .change_presence (activity = activity )
294
313
self .bot .config ['activity_type' ] = activity_type
295
314
self .bot .config ['activity_message' ] = message
296
315
await self .bot .config .update ()
297
316
298
317
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 } .' ,
301
320
color = discord .Color .green ()
302
321
)
303
- await ctx .send (embed = em )
322
+ return await ctx .send (embed = em )
304
323
305
324
@commands .command ()
306
325
@trigger_typing
0 commit comments