mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
Fix game command empty argument. (#3630)
This commit is contained in:
parent
e0de25ed65
commit
b52c838018
@ -1079,16 +1079,14 @@ class Core(commands.Cog, CoreLogic):
|
|||||||
async def _game(self, ctx: commands.Context, *, game: str = None):
|
async def _game(self, ctx: commands.Context, *, game: str = None):
|
||||||
"""Sets [botname]'s playing status"""
|
"""Sets [botname]'s playing status"""
|
||||||
|
|
||||||
|
if game:
|
||||||
if len(game) > 128:
|
if len(game) > 128:
|
||||||
await ctx.send("The maximum length of game descriptions is 128 characters.")
|
await ctx.send("The maximum length of game descriptions is 128 characters.")
|
||||||
else:
|
return
|
||||||
if game:
|
|
||||||
game = discord.Game(name=game)
|
game = discord.Game(name=game)
|
||||||
else:
|
else:
|
||||||
game = None
|
game = None
|
||||||
status = (
|
status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 else discord.Status.online
|
||||||
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.bot.change_presence(status=status, activity=game)
|
||||||
if game:
|
if game:
|
||||||
await ctx.send(_("Status set to ``Playing {game.name}``.").format(game=game))
|
await ctx.send(_("Status set to ``Playing {game.name}``.").format(game=game))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user