From 6c62817de55c08f3610b8dbc0d1345bd68a7163f Mon Sep 17 00:00:00 2001 From: Dav <57032623+Dav-Git@users.noreply.github.com> Date: Mon, 17 Feb 2020 17:48:43 +0100 Subject: [PATCH] [Core] Setting the bot's game/listening/watching displays new text in chat message and is capped at 128 chars. (#3562) * Le code. * Say Status instead of Game/Listening/Watching --- redbot/core/core_commands.py | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index 8a037535c..918af1235 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -1077,13 +1077,21 @@ class Core(commands.Cog, CoreLogic): async def _game(self, ctx: commands.Context, *, game: str = None): """Sets [botname]'s playing status""" - if game: - game = discord.Game(name=game) + if len(game) > 128: + await ctx.send("The maximum length of game descriptions is 128 characters.") else: - game = None - status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else discord.Status.online - await ctx.bot.change_presence(status=status, activity=game) - await ctx.send(_("Game set.")) + if game: + game = discord.Game(name=game) + else: + game = None + status = ( + ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else discord.Status.online + ) + await ctx.bot.change_presence(status=status, activity=game) + if game: + await ctx.send(_(f"Status set to ``Playing {game.name}``.")) + else: + await ctx.send(_("Game cleared.")) @_set.command(name="listening") @checks.bot_in_a_guild() @@ -1097,7 +1105,10 @@ class Core(commands.Cog, CoreLogic): else: activity = None await ctx.bot.change_presence(status=status, activity=activity) - await ctx.send(_("Listening set.")) + if activity: + await ctx.send(_(f"Status set to ``Listening to {listening}``.")) + else: + await ctx.send(_("Listening cleared.")) @_set.command(name="watching") @checks.bot_in_a_guild() @@ -1111,7 +1122,10 @@ class Core(commands.Cog, CoreLogic): else: activity = None await ctx.bot.change_presence(status=status, activity=activity) - await ctx.send(_("Watching set.")) + if activity: + await ctx.send(_(f"Status set to ``Watching {watching}``.")) + else: + await ctx.send(_("Watching cleared.")) @_set.command() @checks.bot_in_a_guild()