cog_info.py 文件源码

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

项目:Godavaru 作者: Godavaru 项目源码 文件源码
def info(self, ctx):
        """Show some of the more statistical information about me.
        This information includes the current version(s), number of commands, amount of servers, channels, users, uptime, and average websocket ping.

        **Usage:** `g_info`

        **Permission:** User"""
        commands = len(self.bot.commands)
        cogs = len(self.bot.cogs)
        version = discord.__version__
        before = time.monotonic()
        await (await self.bot.ws.ping())
        after = time.monotonic()
        ping = (after - before) * 1000
        pversion = platform.python_version()
        server_count = 0
        member_count = 0
        channel_count = 0
        for server in self.bot.guilds:
            server_count += 1
            for channel in server.channels:
                channel_count += 1
            for member in server.members:
                member_count += 1
        await ctx.send("""```prolog
=========[ Bot Information ]=========

Commands           :  {0}
Cogs               :  {1}
Version            :  {2}
DiscordPY Version  :  {3}
Python Version     :  {4}
Websocket Ping     :  {5:.0f}ms
Uptime             :  {6}

=========[ Guild Information ]=========

Guilds             :  {7}
Users              :  {8}
Channels           :  {9}
Host               :  heroku```""".format(commands, cogs, self.bot.version, version, pversion, ping, self.get_bot_uptime(), server_count, member_count, channel_count))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号