mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
[V3] Change presence (continued fixes) (#1438)
* This better fixes the root issue rather than attempting to work around it * move bot_in_guild to checks, and use the correct syntax
This commit is contained in:
parent
749af89e9f
commit
01b9843883
@ -54,6 +54,12 @@ def admin_or_permissions(**perms):
|
||||
return commands.check(predicate)
|
||||
|
||||
|
||||
def bot_in_a_guild(**kwargs):
|
||||
async def predicate(ctx):
|
||||
return len(ctx.bot.guilds) > 0
|
||||
return commands.check(predicate)
|
||||
|
||||
|
||||
def guildowner_or_permissions(**perms):
|
||||
async def predicate(ctx):
|
||||
has_perms_or_is_owner = await check_permissions(ctx, perms)
|
||||
|
||||
@ -386,6 +386,7 @@ class Core:
|
||||
await ctx.send(_("Done."))
|
||||
|
||||
@_set.command(name="game")
|
||||
@checks.bot_in_a_guild()
|
||||
@checks.is_owner()
|
||||
async def _game(self, ctx, *, game: str=None):
|
||||
"""Sets Red's playing status"""
|
||||
@ -396,11 +397,11 @@ class Core:
|
||||
game = None
|
||||
status = ctx.bot.guilds[0].me.status if len(ctx.bot.guilds) > 0 \
|
||||
else discord.Status.online
|
||||
for shard in ctx.bot.shards:
|
||||
await ctx.bot.change_presence(status=status, activity=game)
|
||||
await ctx.send(_("Game set."))
|
||||
|
||||
@_set.command(name="listening")
|
||||
@checks.bot_in_a_guild()
|
||||
@checks.is_owner()
|
||||
async def _listening(self, ctx, *, listening: str=None):
|
||||
"""Sets Red's listening status"""
|
||||
@ -411,11 +412,11 @@ class Core:
|
||||
activity = discord.Activity(name=listening, type=discord.ActivityType.listening)
|
||||
else:
|
||||
activity = None
|
||||
for shard in ctx.bot.shards:
|
||||
await ctx.bot.change_presence(status=status, activity=activity)
|
||||
await ctx.send(_("Listening set."))
|
||||
|
||||
@_set.command(name="watching")
|
||||
@checks.bot_in_a_guild()
|
||||
@checks.is_owner()
|
||||
async def _watching(self, ctx, *, watching: str=None):
|
||||
"""Sets Red's watching status"""
|
||||
@ -426,11 +427,11 @@ class Core:
|
||||
activity = discord.Activity(name=watching, type=discord.ActivityType.watching)
|
||||
else:
|
||||
activity = None
|
||||
for shard in ctx.bot.shards:
|
||||
await ctx.bot.change_presence(status=status, activity=activity)
|
||||
await ctx.send(_("Watching set."))
|
||||
|
||||
@_set.command()
|
||||
@checks.bot_in_a_guild()
|
||||
@checks.is_owner()
|
||||
async def status(self, ctx, *, status: str):
|
||||
"""Sets Red's status
|
||||
@ -455,11 +456,11 @@ class Core:
|
||||
except KeyError:
|
||||
await ctx.send_help()
|
||||
else:
|
||||
for shard in ctx.bot.shards:
|
||||
await ctx.bot.change_presence(status=status, activity=game)
|
||||
await ctx.send(_("Status changed to %s.") % status)
|
||||
|
||||
@_set.command()
|
||||
@checks.bot_in_a_guild()
|
||||
@checks.is_owner()
|
||||
async def stream(self, ctx, streamer=None, *, stream_title=None):
|
||||
"""Sets Red's streaming status
|
||||
@ -473,13 +474,11 @@ class Core:
|
||||
if "twitch.tv/" not in streamer:
|
||||
streamer = "https://www.twitch.tv/" + streamer
|
||||
activity = discord.Streaming(url=streamer, name=stream_title)
|
||||
for shard in ctx.bot.shards:
|
||||
await ctx.bot.change_presence(status=status, activity=activity)
|
||||
elif streamer is not None:
|
||||
await ctx.send_help()
|
||||
return
|
||||
else:
|
||||
for shard in ctx.bot.shards:
|
||||
await ctx.bot.change_presence(activity=None, status=status)
|
||||
await ctx.send(_("Done."))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user