devtools.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:csss-minion 作者: henrymzhao 项目源码 文件源码
def inspect(self, ctx):
    for role in ctx.message.author.roles:
      if self.bot.Henry(ctx) or role.id == '321832268282855436': #bot devs
        theObject = None
        if len(ctx.message.mentions) > 0:
          theObject = ctx.message.mentions[0]
        elif len(ctx.message.channel_mentions) > 0:
          theObject = ctx.message.channel_mentions[0]
        elif len(ctx.message.role_mentions) > 0:
          theObject = ctx.message.role_mentions[0]
        else:
          self.bot.say("I didn't understand what you are inspecting.")

        if theObject is not None:
          items = []
          dictionary = [x for x in dir(theObject) if not x.startswith('_')]
          for name in dictionary:
            attr = getattr(theObject, name)
            if 'object' not in str(attr) and 'method' not in str(attr):
              items.append([str(name), str(attr), False])
          p = Pages(self.bot, message=ctx.message, entries = items, per_page=10)
          p.embed = discord.Embed(title="Inspection Results", colour=discord.Colour(0xdc4643))
          p.embed.set_thumbnail(url="https://cdn.discordapp.com/app-icons/293110345076047893/15e2a6722723827ff9bd53ca787df959.jpg")
          p.embed.set_author(name="CSSS-Minion", icon_url="https://cdn.discordapp.com/app-icons/293110345076047893/15e2a6722723827ff9bd53ca787df959.jpg")
          p.embed.set_footer(text="CSSS-Minion", icon_url="https://cdn.discordapp.com/app-icons/293110345076047893/15e2a6722723827ff9bd53ca787df959.jpg")

          await p.paginate()
      else:
        self.bot.say("You not a dev, shoo!")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号