1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 21:02:38 +00:00

Added error catching for send command, changed to explicit lookup method

This commit is contained in:
Myned 2017-10-30 00:21:45 -04:00
parent cf29e150d2
commit 80f15032f0

View file

@ -67,13 +67,26 @@ class Utils:
@send.command(name='guild', aliases=['g', 'server', 's'])
async def send_guild(self, ctx, guild, channel, *, message):
await discord.utils.get(self.bot.get_all_channels(), guild_name=guild, name=channel).send(message)
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
try:
tempchannel = d.utils.find(lambda m: m.name == channel, d.utils.find(
lambda m: m.name == guild, self.bot.guilds).channels)
try:
await tempchannel.send(message)
await ctx.message.add_reaction('')
except AttributeError:
await ctx.send('**Invalid channel**', delete_after=10)
await ctx.message.add_reaction('')
except AttributeError:
await ctx.send('**Invalid guild**', delete_after=10)
await ctx.message.add_reaction('')
@send.command(name='user', aliases=['u', 'member', 'm'])
async def send_user(self, ctx, user, *, message):
await discord.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
await d.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
await ctx.message.add_reaction('')
@commands.command(aliases=['authenticateupload', 'authupload', 'authup', 'auth'])
async def authenticate_upload(self, ctx):