<commit_before>import discord
from discord.ext import commands
from utils.converters import InsensitiveMemberConverter
from utils.messages import ColoredEmbed, MessageUtils


class Server(commands.Cog):
    """Server related commands."""

    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    @commands.guild_only()
    async def serverinfo(self, ctx):
        """Get information about the server.
        """
        guild = ctx.guild

        roles = ', '.join(
            [role.name for role in guild.roles if role.name != '@everyone'])
        num_text_channels = len(guild.text_channels)
        num_voice_channels = len(guild.voice_channels)
        create_time = MessageUtils.convert_time(guild.created_at)

        embed = ColoredEmbed(title=guild.name)
        embed.add_field(name='ID', value=guild.id)
        embed.add_field(name='Owner', value=f'{guild.owner}')
        embed.add_field(name='Server Region', value=guild.region)
        embed.add_field(name='Members', value=guild.member_count)
        embed.add_field(name='Text Channels', value=num_voice_channels)
        embed.add_field(name='Voice Channels', value=num_text_channels)
        embed.add_field(name='Roles', value=roles, inline=False)
        embed.set_footer(text=f'Created on {create_time}')
        embed.set_thumbnail(url=guild.icon_url)
        await ctx.send(embed=embed)

    @commands.command()
    @commands.guild_only()
    async def avatar(self, ctx, *, member: InsensitiveMemberConverter = None):
        """Get someone's avatar.

        Args:
            member (optional): the member. Defaults to the invoker if a member is not specified
        """
        if member is None:
            member = ctx.author

        avatar = member.avatar_url_as(static_format='png')

        embed = ColoredEmbed()
        embed.set_author(name=member, icon_url=avatar)
        embed.set_image(url=avatar)
        await ctx.send(embed=embed)

    @commands.command()
    @commands.guild_only()
    async def userinfo(self, ctx, *, member: InsensitiveMemberConverter = None):
        """Get information about a user.

        Args:
            member (optional): the member. Defaults to the invoker if a member is not specified
        """
        if member is None:
            member = ctx.author

        roles = ', '.join(
            [role.name for role in member.roles if role.name != '@everyone'])
        join_time = MessageUtils.convert_time(member.joined_at)
        register_time = MessageUtils.convert_time(member.created_at)

        embed = ColoredEmbed()
        embed.set_author(name=member, icon_url=member.avatar_url)
        embed.add_field(name='ID', value=member.id, inline=False)
        embed.add_field(name='Join Time', value=join_time)
        embed.add_field(name='Register Time', value=register_time)
        embed.add_field(name='Roles', value=roles, inline=False)
        embed.add_field(name='Activity', value=member.activity)<commit_msg>Fix userinfo formatting<commit_after>import discord
from discord.ext import commands
from utils.converters import InsensitiveMemberConverter
from utils.messages import ColoredEmbed, MessageUtils


class Server(commands.Cog):
    """Server related commands."""

    def __init__(self, bot):
        self.bot = bot

    @commands.command()
    @commands.guild_only()
    async def serverinfo(self, ctx):
        """Get information about the server.
        """
        guild = ctx.guild

        roles = ', '.join(
            [role.name for role in guild.roles if role.name != '@everyone'])
        num_text_channels = len(guild.text_channels)
        num_voice_channels = len(guild.voice_channels)
        create_time = MessageUtils.convert_time(guild.created_at)

        embed = ColoredEmbed(title=guild.name)
        embed.add_field(name='ID', value=guild.id)
        embed.add_field(name='Owner', value=f'{guild.owner}')
        embed.add_field(name='Server Region', value=guild.region)
        embed.add_field(name='Members', value=guild.member_count)
        embed.add_field(name='Text Channels', value=num_voice_channels)
        embed.add_field(name='Voice Channels', value=num_text_channels)
        embed.add_field(name='Roles', value=roles, inline=False)
        embed.set_footer(text=f'Created on {create_time}')
        embed.set_thumbnail(url=guild.icon_url)
        await ctx.send(embed=embed)

    @commands.command()
    @commands.guild_only()
    async def avatar(self, ctx, *, member: InsensitiveMemberConverter = None):
        """Get someone's avatar.

        Args:
            member (optional): the member. Defaults to the invoker if a member is not specified
        """
        if member is None:
            member = ctx.author

        avatar = member.avatar_url_as(static_format='png')

        embed = ColoredEmbed()
        embed.set_author(name=member, icon_url=avatar)
        embed.set_image(url=avatar)
        await ctx.send(embed=embed)

    @commands.command()
    @commands.guild_only()
    async def userinfo(self, ctx, *, member: InsensitiveMemberConverter = None):
        """Get information about a user.

        Args:
            member (optional): the member. Defaults to the invoker if a member is not specified
        """
        if member is None:
            member = ctx.author

        roles = ', '.join(
            [role.name for role in member.roles if role.name != '@everyone'])
        join_time = MessageUtils.convert_time(member.joined_at)
        register_time = MessageUtils.convert_time(member.created_at)

        embed = ColoredEmbed()
        embed.set_author(name=member, icon_url=member.avatar_url)
        embed.add_field(name='ID', value=member.id)
        embed.add_field(name='Nickname', value=member.nick)
        embed.add_field(name='Join Time', value=join_time)
        embed.add_field(name='Register Time', value=register_time)
        embed.add_field(name='Roles', value=roles, inline=False)
        embed.add_field(name='Activity', value=member.activity.name)
{'fraction_non_alphanumeric': 0.11271820448877805, 'fraction_numerical': 0.0, 'mean_word_length': 2.99734219269103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3460188', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1767, 'n_words': 380}