|
1 | 1 | import discord |
2 | 2 | from discord.ext import commands |
| 3 | +from discord.enums import ActivityType |
| 4 | + |
3 | 5 | import datetime |
4 | 6 | import traceback |
5 | 7 | import inspect |
@@ -268,26 +270,36 @@ async def update(self, ctx): |
268 | 270 |
|
269 | 271 | await ctx.send(embed=em) |
270 | 272 |
|
271 | | - @commands.command(name='status', aliases=['customstatus', 'presence']) |
| 273 | + @commands.command(aliases=['presence']) |
272 | 274 | @commands.has_permissions(administrator=True) |
273 | | - async def _status(self, ctx, *, message): |
274 | | - """Set a custom playing status for the bot. |
275 | | -
|
276 | | - Set the message to `clear` if you want to remove the playing status. |
| 275 | + async def status(self, ctx, activity_type: str, *, message: str = ''): |
277 | 276 | """ |
| 277 | + Set a custom playing status for the bot. |
278 | 278 |
|
279 | | - if message == 'clear': |
280 | | - self.bot.config['status'] = None |
| 279 | + [prefix]status activity message... |
| 280 | +
|
| 281 | + Set the message to `clear` if you want to remove the status. |
| 282 | + """ |
| 283 | + if activity_type == 'clear': |
| 284 | + await self.bot.change_presence(activity=None) |
| 285 | + self.bot.config['activity_type'] = None |
| 286 | + self.bot.config['activity_message'] = None |
281 | 287 | await self.bot.config.update() |
282 | | - return await self.bot.change_presence(activity=None) |
| 288 | + return |
283 | 289 |
|
284 | | - await self.bot.change_presence(activity=discord.Game(message)) |
285 | | - self.bot.config['status'] = message |
| 290 | + activity_type = ActivityType[activity_type] |
| 291 | + self.bot: commands.Bot |
| 292 | + activity = discord.Activity(type=activity_type, name=message) |
| 293 | + await self.bot.change_presence(activity=activity) |
| 294 | + self.bot.config['activity_type'] = activity_type |
| 295 | + self.bot.config['activity_message'] = message |
286 | 296 | await self.bot.config.update() |
287 | 297 |
|
288 | | - em = discord.Embed(title='Status Changed') |
289 | | - em.description = message |
290 | | - em.color = discord.Color.green() |
| 298 | + em = discord.Embed( |
| 299 | + title='Status Changed', |
| 300 | + description=f'{ActivityType(activity_type)}: {message}.', |
| 301 | + color=discord.Color.green() |
| 302 | + ) |
291 | 303 | await ctx.send(embed=em) |
292 | 304 |
|
293 | 305 | @commands.command() |
|
0 commit comments