import discord
from discord.ext import commands


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

    @commands.command(aliases=['ms'])
    @commands.guild_only()
    async def memberstatus(self, ctx):
        """zie hoeveel mensjes er online, offline, afk en dnd zijn"""
        on = 0  # Stands for online
        off = 0  # Stands for offline
        dnd = 0  # Stands for do not disturb
        idle = 0  # Stands for idle/afk
        for member in ctx.guild.members:
            if member.status == discord.Status.online:
                on = on + 1
            elif member.status == discord.Status.offline:
                off = off + 1
            elif member.status == discord.Status.idle:
                idle = idle + 1
            elif member.status == discord.Status.dnd:
                dnd = dnd + 1
        embed = discord.Embed(title='Member Status', color=0xff0000)
        embed.add_field(name='Online', value=on, inline=True)
        embed.add_field(name='Offline', value=off, inline=False)
        embed.add_field(name='Idle', value=idle, inline=True)
        embed.add_field(name='DND', value=dnd, inline=False)
        await ctx.send(embed=embed)

    @commands.command()
    @commands.guild_only()
    async def members(self, ctx):
        """zie hoeveel mensjes er in de server zitten"""
        await ctx.send(f'This server has {len(ctx.guild.members)} members!')


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


