コード例 #1
0
 async def unblock(self, ctx, *, user):
     """Unblocks the user you provide."""
     try:
         member = get_user(user, ctx.message)
         unblock_user(str(member.id))
         await success(ctx.message)
         await asyncio.sleep(5)
         await ctx.message.delete()
     except:
         from traceback import format_exc
         await ctx.send(self.bot.bot_prefix +
                        " Error:\n\n%s" % format_exc())
コード例 #2
0
 async def finduser(self, ctx, *, user):
     """Debug command. Checks if we could find the user you're searching for."""
     try:
         member = get_user(user, ctx.message, self.bot)
         if not member:
             return await ctx.send("User \"%s\" not found." % user)
         _msg = "User found: %s#%s (%s)" % (member.name,
                                            member.discriminator, member.id)
         if hasattr(member, 'guild'):
             _msg += "\nMember of guild: %s (%s)" % (member.guild.name,
                                                     member.guild.id)
         await ctx.send(_msg,
                        embed=discord.Embed(description=member.mention))
     except:
         from traceback import format_exc
         await ctx.send(self.bot.bot_prefix +
                        " Error:\n\n%s" % format_exc())