Browse Source

Lots of small changes to improve speed and make sure commands are explicit in being guild only

tags/v2.0.0
Roxie Gibson 5 years ago
parent
commit
ad85a060c7
7 changed files with 13 additions and 6 deletions
  1. +2
    -0
      roxbot/cogs/admin.py
  2. +4
    -3
      roxbot/cogs/joinleave.py
  3. +1
    -0
      roxbot/cogs/nsfw.py
  4. +1
    -1
      roxbot/cogs/reddit.py
  5. +1
    -1
      roxbot/cogs/selfassign.py
  6. +2
    -0
      roxbot/cogs/twitch.py
  7. +2
    -1
      roxbot/cogs/voice.py

+ 2
- 0
roxbot/cogs/admin.py View File

@@ -119,6 +119,7 @@ class Admin:
;slowmode [time/"off"]
seconds = number of seconds for the cooldown between messages a user has.
off = turns off slowmode for this channel"""
# TODO: Edit this when api is avalible for discord's new slowmode feature.
if seconds == "off" and self.slow_mode: # Turn Slow Mode off
self.slow_mode = False
self.slow_mode_channels.pop(ctx.channel.id)
@@ -138,6 +139,7 @@ class Admin:
else:
pass

@commands.guild_only()
@commands.has_permissions(manage_messages=True)
@commands.bot_has_permissions(manage_messages=True, read_message_history=True)
@commands.cooldown(1, 5)

+ 4
- 3
roxbot/cogs/joinleave.py View File

@@ -70,7 +70,7 @@ class JoinLeave():
colour=roxbot.EmbedColours.pink)
em.set_thumbnail(url=member.avatar_url)

channel = self.bot.get_channel(settings["greets"]["welcome-channel"])
channel = member.guild.get_channel(settings["greets"]["welcome-channel"])
return await channel.send(embed=em)

async def on_member_remove(self, member):
@@ -82,10 +82,11 @@ class JoinLeave():
if not settings["goodbyes"]["enabled"]:
return
else:
channel = self.bot.get_channel(channel)
channel = member.guild.get_channel(channel)
return await channel.send(embed=discord.Embed(
description="{}#{} has left or been beaned.".format(member.name, member.discriminator), colour=roxbot.EmbedColours.pink))

@commands.guild_only()
@commands.has_permissions(manage_messages=True)
@commands.command()
async def greets(self, ctx, setting, channel: typing.Optional[discord.TextChannel] = None, *, text: str):
@@ -116,7 +117,7 @@ class JoinLeave():
return await ctx.send("No valid option given.")
return settings.update(greets, "greets")

@commands.guild_only()
@commands.has_permissions(manage_messages=True)
@commands.command()
async def goodbyes(self, ctx, setting, *, channel: typing.Optional[discord.TextChannel] = None):

+ 1
- 0
roxbot/cogs/nsfw.py View File

@@ -120,6 +120,7 @@ class NFSW():
post_url = "https://simg3.gelbooru.com/images/"
return await ctx.invoke(self.gelbooru_clone, base_url=base_url, post_url=post_url, tags=tags)

@commands.guild_only()
@commands.has_permissions(manage_channels=True)
@commands.command()
async def nsfw(self, ctx, setting, *, changes=None):

+ 1
- 1
roxbot/cogs/reddit.py View File

@@ -175,7 +175,7 @@ class Reddit:
if ctx.invoked_with == "subreddit" and isinstance(ctx.channel, discord.TextChannel):
# Only log the command when it is this command being used. Not the inbuilt commands.
logging = guild_settings.get(ctx.guild)["logging"]
log_channel = self.bot.get_channel(logging["channel"])
log_channel = ctx.guild.get_channel(logging["channel"])
await roxbot.log(
ctx.guild,
log_channel,

+ 1
- 1
roxbot/cogs/selfassign.py View File

@@ -50,8 +50,8 @@ class SelfAssign():
sa["roles"].remove(role.id)
return settings.update(sa, "self_assign")

@commands.has_permissions(manage_roles=True)
@commands.guild_only()
@commands.has_permissions(manage_roles=True)
@commands.command(aliases=["sa"])
async def selfassign(self, ctx, setting, *, role: discord.Role):
"""Edits settings for self assign cog. Requires Manage Roles permission.

+ 2
- 0
roxbot/cogs/twitch.py View File

@@ -61,6 +61,7 @@ class Twitch():
return await channel.send(":video_game:** {} is live!** :video_game:\n{}\n{}".format(
member_a.name, member_a.game.name, member_a.game.url))

@commands.guild_only()
@commands.group(aliases=["wl"])
@commands.has_permissions(manage_channels=True)
async def whitelist(self, ctx):
@@ -116,6 +117,7 @@ class Twitch():
elif option == 'list':
return await ctx.send(settings["twitch"]["whitelist"]["list"])

@commands.guild_only()
@commands.has_permissions(manage_channels=True)
@commands.command()
async def twitch(self, ctx, setting, *, channel: discord.TextChannel = None):

+ 2
- 1
roxbot/cogs/voice.py View File

@@ -112,7 +112,7 @@ class NowPlayingEmbed(discord.Embed):
Duration: {1}
Queued by: {0.queued_by}""".format(now_playing, duration)
image = np.thumbnail_url
footer_text="{}/{} | Volume: {}%".format(time_played, duration, int(now_playing.volume * 100))
footer_text = "{}/{} | Volume: {}%".format(time_played, duration, int(now_playing.volume * 100))
return cls(
title=title,
url=np.webpage_url,
@@ -497,6 +497,7 @@ class Voice:
except AttributeError:
raise commands.CommandError("I'm not playing anything.")

@commands.guild_only()
@commands.has_permissions(manage_channels=True)
@commands.command()
async def voice(self, ctx, setting=None, change=None):

Loading…
Cancel
Save