mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 11:48:55 -05:00
[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:
parent
de4af14676
commit
93ca7abc1a
@ -375,10 +375,14 @@ class Core:
|
|||||||
|
|
||||||
@_set.command(name="game")
|
@_set.command(name="game")
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
@commands.guild_only()
|
|
||||||
async def _game(self, ctx, *, game: str=None):
|
async def _game(self, ctx, *, game: str=None):
|
||||||
"""Sets Red's playing status"""
|
"""Sets Red's playing status
|
||||||
status = ctx.me.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:
|
if game:
|
||||||
game = discord.Game(name=game)
|
game = discord.Game(name=game)
|
||||||
else:
|
else:
|
||||||
@ -389,8 +393,13 @@ class Core:
|
|||||||
@_set.command(name="listening")
|
@_set.command(name="listening")
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def _listening(self, ctx, *, listening: str=None):
|
async def _listening(self, ctx, *, listening: str=None):
|
||||||
"""Sets Red's listening status"""
|
"""Sets Red's listening status
|
||||||
status = ctx.me.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:
|
if listening:
|
||||||
listening = discord.Game(name=listening, type=2)
|
listening = discord.Game(name=listening, type=2)
|
||||||
else:
|
else:
|
||||||
@ -401,8 +410,13 @@ class Core:
|
|||||||
@_set.command(name="watching")
|
@_set.command(name="watching")
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def _watching(self, ctx, *, watching: str=None):
|
async def _watching(self, ctx, *, watching: str=None):
|
||||||
"""Sets Red's watching status"""
|
"""Sets Red's watching status
|
||||||
status = ctx.me.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:
|
if watching:
|
||||||
watching = discord.Game(name=watching, type=3)
|
watching = discord.Game(name=watching, type=3)
|
||||||
else:
|
else:
|
||||||
@ -412,14 +426,16 @@ class Core:
|
|||||||
|
|
||||||
@_set.command()
|
@_set.command()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
@commands.guild_only()
|
|
||||||
async def status(self, ctx, *, status: str):
|
async def status(self, ctx, *, status: str):
|
||||||
"""Sets Red's status
|
"""Sets Red's status
|
||||||
|
|
||||||
Available statuses:
|
Available statuses:
|
||||||
online
|
online
|
||||||
idle
|
idle
|
||||||
dnd
|
dnd
|
||||||
invisible"""
|
invisible
|
||||||
|
|
||||||
|
Can only be run if the bot is in a server."""
|
||||||
|
|
||||||
statuses = {
|
statuses = {
|
||||||
"online": discord.Status.online,
|
"online": discord.Status.online,
|
||||||
@ -428,7 +444,10 @@ class Core:
|
|||||||
"invisible": discord.Status.invisible
|
"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:
|
try:
|
||||||
status = statuses[status.lower()]
|
status = statuses[status.lower()]
|
||||||
@ -441,12 +460,14 @@ class Core:
|
|||||||
|
|
||||||
@_set.command()
|
@_set.command()
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
@commands.guild_only()
|
|
||||||
async def stream(self, ctx, streamer=None, *, stream_title=None):
|
async def stream(self, ctx, streamer=None, *, stream_title=None):
|
||||||
"""Sets Red's streaming status
|
"""Sets Red's streaming status
|
||||||
Leaving both streamer and stream_title empty will clear it."""
|
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:
|
if stream_title:
|
||||||
stream_title = stream_title.strip()
|
stream_title = stream_title.strip()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user