[V3 Core Commands] Limit status modifying commands to be run in guild only (#1331)

* Limit status modifying commands to be run in guild only

* JK let em run.

* Add a space
This commit is contained in:
Will 2018-02-22 20:44:06 -05:00 committed by Kowlin
parent de4af14676
commit 93ca7abc1a

View File

@ -375,10 +375,14 @@ class Core:
@_set.command(name="game")
@checks.is_owner()
@commands.guild_only()
async def _game(self, ctx, *, game: str=None):
"""Sets Red's playing status"""
status = ctx.me.status
"""Sets Red's playing status
Can only be run if the bot is in a server."""
if len(ctx.bot.guilds) == 0:
await ctx.send_help()
return
status = ctx.bot.guilds[0].me.status
if game:
game = discord.Game(name=game)
else:
@ -389,8 +393,13 @@ class Core:
@_set.command(name="listening")
@checks.is_owner()
async def _listening(self, ctx, *, listening: str=None):
"""Sets Red's listening status"""
status = ctx.me.status
"""Sets Red's listening status
Can only be run if the bot is in a server."""
if len(ctx.bot.guilds) == 0:
await ctx.send_help()
return
status = ctx.bot.guilds[0].me.status
if listening:
listening = discord.Game(name=listening, type=2)
else:
@ -401,8 +410,13 @@ class Core:
@_set.command(name="watching")
@checks.is_owner()
async def _watching(self, ctx, *, watching: str=None):
"""Sets Red's watching status"""
status = ctx.me.status
"""Sets Red's watching status
Can only be run if the bot is in a server."""
if len(ctx.bot.guilds) == 0:
await ctx.send_help()
return
status = ctx.bot.guilds[0].me.status
if watching:
watching = discord.Game(name=watching, type=3)
else:
@ -412,23 +426,28 @@ class Core:
@_set.command()
@checks.is_owner()
@commands.guild_only()
async def status(self, ctx, *, status: str):
"""Sets Red's status
Available statuses:
online
idle
dnd
invisible"""
invisible
Can only be run if the bot is in a server."""
statuses = {
"online" : discord.Status.online,
"idle" : discord.Status.idle,
"dnd" : discord.Status.dnd,
"invisible" : discord.Status.invisible
"online": discord.Status.online,
"idle": discord.Status.idle,
"dnd": discord.Status.dnd,
"invisible": discord.Status.invisible
}
game = ctx.me.game
if len(ctx.bot.guilds) == 0:
await ctx.send_help()
return
game = ctx.bot.guilds[0].me.game
try:
status = statuses[status.lower()]
@ -441,12 +460,14 @@ class Core:
@_set.command()
@checks.is_owner()
@commands.guild_only()
async def stream(self, ctx, streamer=None, *, stream_title=None):
"""Sets Red's streaming status
Leaving both streamer and stream_title empty will clear it."""
status = ctx.me.status
if len(ctx.bot.guilds) == 0:
await ctx.send_help()
return
status = ctx.bot.guilds[0].me.status
if stream_title:
stream_title = stream_title.strip()