Exemplo n.º 1
0
    async def about(self, ctx: commands.Context):
        """
        View info of the bot
        """
        data = {
            "id": self.bot.user.id,
            "owner": "StarrFox#6312",
            "created": humanize.naturaldate(self.bot.user.created_at),
            "up since": humanize.naturaltime(self.bot.uptime),
            "guilds": len(self.bot.guilds),
            "commands": len(set(self.bot.walk_commands())),
            "dc version": dc_version,
            "d.py version": discord.__version__,
        }

        events_cog = self.bot.get_cog("events")

        if events_cog:
            data.update({
                "events seen":
                "{:,}".format(sum(events_cog.socket_events.values()))
            })

        paginator = PrologPaginator()

        paginator.recursively_add_dictonary({self.bot.user.name: data})

        source = NormalPageSource(paginator.pages)

        menu = DCMenuPages(source)

        await menu.start(ctx)
Exemplo n.º 2
0
    async def guildinfo(self, ctx: commands.Context):
        """
        Get info on a guild
        """
        guild = ctx.guild
        bots = len([m for m in guild.members if m.bot])
        humans = guild.member_count - bots

        data = {
            "id": guild.id,
            "owner": str(guild.owner),
            "created": humanize.naturaltime(guild.created_at),
            "# of roles": len(guild.roles),
            "members": {"humans": humans, "bots": bots, "total": guild.member_count},
            "channels": {
                "categories": len(guild.categories),
                "text": len(guild.text_channels),
                "voice": len(guild.voice_channels),
                "total": len(guild.channels),
            },
        }

        paginator = PrologPaginator()

        paginator.recursively_add_dictonary({guild.name: data})

        source = NormalPageSource(paginator.pages)

        menu = DCMenuPages(source)

        await menu.start(ctx)
Exemplo n.º 3
0
    async def memberinfo(self,
                         ctx: commands.Context,
                         member: FetchedMember = None):
        """
        Get info on a guild member
        """
        if member is None:
            member = await ctx.guild.fetch_member(ctx.author.id)

        data = {
            "id": member.id,
            "top role": member.top_role.name,
            "joined guild": humanize.naturaldate(member.joined_at),
            "joined discord": humanize.naturaldate(member.created_at),
        }

        paginator = PrologPaginator()

        paginator.recursively_add_dictonary({member.name: data})

        source = NormalPageSource(paginator.pages)

        menu = DCMenuPages(source)

        await menu.start(ctx)
Exemplo n.º 4
0
    async def socketstats(self, ctx: commands.Context):
        """
        View soketstats of the bot
        """
        events_cog = self.bot.get_cog("events")
        socket_events = events_cog.socket_events
        total = sum(socket_events.values())
        paginator = PrologPaginator(align_places=20)
        paginator.recursively_add_dictonary(
            {f"{total:,} total": socket_events})
        source = NormalPageSource(paginator.pages)
        menu = DCMenuPages(source)

        await menu.start(ctx)
Exemplo n.º 5
0
    async def guildinfo(self, ctx: commands.Context):
        """
        Get info on a guild
        """
        guild = await self.bot.fetch_guild(ctx.guild.id)

        # I don't have guild.channels
        channels = await guild.fetch_channels()

        data = {
            "id": guild.id,
            "owner": str(await self.bot.fetch_user(guild.owner_id)),
            "created": humanize.naturaltime(guild.created_at),
            "# of roles": len(guild.roles),
            "members": guild.approximate_member_count,
            "channels": {
                "categories":
                len([
                    c for c in channels
                    if isinstance(c, discord.CategoryChannel)
                ]),
                "text":
                len([
                    c for c in channels if isinstance(c, discord.TextChannel)
                ]),
                "voice":
                len([
                    c for c in channels if isinstance(c, discord.VoiceChannel)
                ]),
                "total":
                len(channels),
            },
        }

        paginator = PrologPaginator()
        paginator.recursively_add_dictonary({guild.name: data})
        source = NormalPageSource(paginator.pages)
        menu = DCMenuPages(source)

        await menu.start(ctx)