import discord
from discord.ext import commands
from pyfiglet import Figlet
from dep import admin_roles
from dep import is_dev


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


    @commands.command()
    async def ping(self, ctx, dec=3):
        """Geeft de huidige ping van de bot"""
        await ctx.send(f'`Pong: {round(self.bot.latency, dec)} ms`')


    @commands.command(aliases=['whois'])
    @commands.guild_only()
    async def userinfo(self, ctx, user: discord.Member):
        """krijg info over iemand"""
        embed = discord.Embed(title='Hier is wat info', color=0xFF69B4)
        embed.set_author(name=user.name, icon_url=user.avatar_url)
        embed.add_field(name='Hoogste rol', value=user.top_role, inline=True)
        embed.add_field(name='Server gejoined op', value=user.joined_at, inline=False)
        embed.add_field(name='Status', value=user.status, inline=True)
        embed.set_image(url=user.avatar_url)
        await ctx.send(embed=embed)

    @commands.command()
    @commands.guild_only()
    async def banlist(self, ctx):
        """krijg een lijst van alle mensjes die verbannen zijn"""
        embed = discord.Embed(title='List of banned members', color=0xFF69B4)
        bans = await ctx.guild.bans()
        for ban in bans:
            embed.add_field(name='Banned', value=ban[1])
        await ctx.send(embed=embed)


    @commands.command()
    @commands.check(is_dev)
    async def activity(self, ctx, act):
        """Verandert de huidige activiteit van de bot"""
        await self.bot.change_presence(activity=discord.Game(name=act))
        await ctx.send(f'De huidige activiteit is nu: {act}')

    @commands.command()
    async def introduce(self, ctx):
        """Doet nog een beetje kut"""
        f = Figlet(font='lean')
        text = f.renderText('Japbot')
        await ctx.send(f'Hallo, ik ben\n```{text}```')


def setup(bot):
    bot.add_cog(Standard(bot))
