Compare commits

..

No commits in common. "bc6a0d300cfdc7e8414d788ce04d3548482983fa" and "e3c0d2b44413940135804561d6aee4c3bfd7a7d9" have entirely different histories.

2 changed files with 8 additions and 9 deletions

View File

@ -89,7 +89,7 @@ class Train(commands.Cog):
return "".join(arr) return "".join(arr)
async def sendEmbed(self, ctx, embed): async def sendEmbed(self, ctx, embed):
if await checks.allowedChannels(ctx): if checks.allowedChannels(ctx):
await ctx.send(embed=embed) await ctx.send(embed=embed)
else: else:
await ctx.author.send(embed=embed) await ctx.author.send(embed=embed)

View File

@ -8,23 +8,22 @@ import requests
from functions.database import currency from functions.database import currency
# Checks if caller of a command is the owner of the bot # Checks if caller of a command is me
async def isMe(ctx): def isMe(ctx):
# return str(ctx.author.id) == constants.myId return str(ctx.author.id) == constants.myId
return await ctx.bot.is_owner(ctx.author)
# Checks if the caller of a command is an admin # Checks if the caller of a command is an admin
async def isMod(ctx): def isMod(ctx):
if ctx.guild is None: if ctx.guild is None:
return await isMe(ctx) return isMe(ctx)
return ctx.author.id in constants.mods[ctx.guild.id] return ctx.author.id in constants.mods[ctx.guild.id]
# Checks if a command is allowed to be used in this channel # Checks if a command is allowed to be used in this channel
async def allowedChannels(ctx): def allowedChannels(ctx):
return (await isMe(ctx)) or ctx.channel.type == discord.ChannelType.private or int(ctx.channel.id) in constants.allowedChannels.values() return isMe(ctx) or ctx.channel.type == discord.ChannelType.private or int(ctx.channel.id) in constants.allowedChannels.values()
# TODO find a better way to check for legit links because reddit posts return a 502 # TODO find a better way to check for legit links because reddit posts return a 502