Example #1
0
    async def serverinfo(self, ctx: commands.Context, server_id: Optional[int] = None) -> None:
        """Member count, owner, channel names, roles, and emojis."""

        if server_id is None:
            guild = ctx.message.guild
        else:
            guild = self.bot.get_guild(server_id)

        embed = c.get_guild_info_embed(guild)

        # ...and send
        try:
            await ctx.send(embed=embed)
        except discord.HTTPException:
            log.info("Guild info still too long, can't send...")
Example #2
0
    async def on_guild_join(self, guild: discord.Guild) -> None:
        """Notify me when added to guild"""

        if guild.id in BANNED_GUILD_IDS:
            self.log.warning(f'Banned guild {guild.id} attempted to add crimsoBOT.')
            await guild.leave()
            return

        self.log.info(f"Joined {guild.owner}'s {guild} ({guild.id})")

        embed = c.get_guild_info_embed(guild)

        # ...and send
        for user_id in ADMIN_USER_IDS:
            user = self.get_user(user_id)

            try:
                await user.send("I've been added to a server!", embed=embed)
            except Exception:
                await user.send(f"I've been added to {guild} ({guild.id})!")