mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[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
This commit is contained in:
parent
7c06d9a638
commit
6c62817de5
@ -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 len(game) > 128:
|
||||
await ctx.send("The maximum length of game descriptions is 128 characters.")
|
||||
else:
|
||||
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
|
||||
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:
|
||||
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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user