<gh_stars>0
import discord, json, asyncio
from discord.ext import commands
from discord import Embed
from discord.ext.commands import has_permissions
from discord.ext.commands import MissingPermissions
check = "✅"

def get_prefix(client, message):

        with open("prefixes.json", "r") as f:
            prefixes =json.load(f)

        return prefixes[str(message.guild.id)]

class ModCommands(commands.Cog):
    def __init__(self, client):
        self.client = client
# kick, ban, unban
    @commands.command(name="kick")
    @commands.has_permissions(kick_members=True)
    async def kick(self, ctx, member : discord.Member, *, reason=None):
        await member.kick(reason=reason)
        embed=Embed(title="AkumaKick", url="https://www.lunarclient.com/", description=f"**{member.name} has been kicked by {ctx.message.author} for {reason}!**", color=0x40DA27)
        await ctx.send(embed=embed)
        user = member
        kick=Embed(title="AkumaKick", url="https://www.lunarclient.com/", description=f"**You have been kicked by {ctx.message.author} for {reason}!**", color=0x40DA27)
        await user.send(embed=kick)
        print(f"Kicked {member.name} from {ctx.guild.name}")
    @commands.command(name="ban")
    @commands.has_permissions(ban_members=True)
    async def ban(self, ctx, member : discord.Member, *, reason=None):
        await member.ban(reason=reason)
        embed=Embed(title="AkumaBan", url="https://www.lunarclient.com/", description=f"**{member.name} has been banned by {ctx.message.author} for {reason}!**", color=0x40DA27)
        await ctx.send(embed=embed)
        user = member
        ban=Embed(title="AkumaBan", url="https://www.lunarclient.com/", description=f"**You have been banned by {ctx.message.author} for {reason}!**", color=0x40DA27)
        await user.send(embed=ban)
        print(f"Banned {member.name} from {ctx.guild.name}")
    @commands.command(name="unban")
    @commands.has_permissions(ban_members=True)
    async def unban(ctx, *, user=None):

        try:
            user = await commands.converter.UserConverter().convert(ctx, user)
        except:
            await ctx.send("Error: User could not be found!")
            return

        try:
            bans = tuple(ban_entry.user for ban_entry in await ctx.guild.bans())
            if user in bans:
                await ctx.guild.unban(user, reason="Responsible moderator: "+ str(ctx.author))
            else:
                await ctx.send("User is not banned!")
                return

        except discord.Forbidden:
            await ctx.send("Client does not have permission to unban!")
            return

        except:
            await ctx.send("Unbanning failed!")
            return

        await ctx.send(f"Successfully unbanned {user.mention}!")
        print(f"Unbanned {user} from {ctx.guild.name}.")

    @commands.command(name="clear", aliases=["purge", "delete"])
    @commands.has_permissions(manage_messages=True)
    async def clear(self, ctx, amount: int):
        if amount == None:
            await ctx.channel.purge(limit=10000)
            
        else:
            await ctx.channel.purge(limit=amount+1)
            embed=discord.Embed(title="Akuma-Clear", url="https://www.lunarclient.com/", description=f"**I have deleted {amount} message(s)!**", color=0x40DA27)
            await ctx.send(embed=embed, delete_after = 10)
            print(f"{ctx.guild.name}: Deleted {amount} messages!")
         
    @commands.command(name="say")
    @commands.has_permissions(administrator=True)
    async def say(self, ctx, *args):
	    response = ""

	    for arg in args:
		    response = response + " " + arg

	    await ctx.channel.send(response), await ctx.message.delete()

    @commands.command(name="role", aliases=["addrole"])
    @commands.has_permissions(manage_roles=True)
    async def role(self, ctx, user: discord.Member, role: discord.Role):
        if ctx.author.guild_permissions.administrator:
            await user.add_roles(role)
            await ctx.message.add_reaction(check)
        else:
            embed=discord.Embed(description="**You can't do that!:x: You are lacking the permission!**", color=0x40DA27)
            await ctx.send(embed=embed)


    @commands.command(name="roleall")
    @commands.has_permissions(manage_roles=True)
    async def roleall(self, ctx, role : discord.Role):
        for member in ctx.guild.members:
            await member.add_roles(role)
            await ctx.message.add_reaction(check)

    @commands.command(name="remroleall", aliases=["removeroleall", "rra"])
    @commands.has_permissions(manage_roles=True)
    async def remroleall(self, ctx, role : discord.Role):
        for member in ctx.guild.members:
            await member.remove_roles(role)
            await ctx.message.add_reaction(check)

    @commands.command(name="removerole", aliases=["remrole", "roleremove"])
    @commands.has_permissions(manage_roles=True)
    async def removerole(self, ctx, user: discord.Member, *, role: discord.Role):
        await user.remove_roles(role)
        await ctx.message.add_reaction(check)

    @commands.command(name="prefix")
    async def prefix(self, ctx, prefix):
        with open("prefixes.json", "r") as f:
                prefixes =json.load(f)

        prefixes[str(ctx.guild.id)] = prefix

        with open("prefixes.json", "w") as f:
            json.dump(prefixes, f, indent=4)
        await ctx.message.add_reaction(check)
        embed=discord.Embed(title="Prefix changed:", url="https://www.lunarclient.com/", description= f"(Guild: {ctx.guild.id}//{ctx.guild.name}) (New preifx: {prefix})", color=0x40DA27)
        await ctx.send(embed=embed)
        print(f"Prefix changed: (Guild: {ctx.guild.id}//{ctx.guild.name}) (New preifx: {prefix})")

    @commands.command(name="guildid", pass_context=True)
    async def guildid(self, ctx):
        id = ctx.message.guild.id
        await ctx.send(f"{id}")
        print(f"GetGuild: Command executed by: {ctx.author}, {ctx.guild.id}//{ctx.guild.name}")

    @commands.command(name="slowmode")
    @commands.has_permissions(manage_channels=True)
    async def slowmode(self, ctx, seconds: int):
        await ctx.channel.edit(slowmode_delay=seconds)
        embed=discord.Embed(title="Slowmode:", url="https://www.lunarclient.com/", description= f"**Slowmode is now at {seconds} seconds.**", color=0x40DA27)
        await ctx.send(embed=embed)
        


def setup(client):
    client.add_cog(ModCommands(client))

# Github: https://github.com/SearchAvocado\n Discord: Avocado#2878
import discord, json, asyncio
from discord.ext import commands
from discord import Embed
from discord.ext.commands import has_permissions
from discord.ext.commands import MissingPermissions
check = "✅"

def get_prefix(client, message):

        with open("prefixes.json", "r") as f:
            prefixes =json.load(f)

        return prefixes[str(message.guild.id)]

class ModCommands(commands.Cog):
    def __init__(self, client):
        self.client = client
# kick, ban, unban
    @commands.command(name="kick")
    @commands.has_permissions(kick_members=True)
    async def kick(self, ctx, member : discord.Member, *, reason=None):
        await member.kick(reason=reason)
        embed=Embed(title="AkumaKick", url="https://www.lunarclient.com/", description=f"**{member.name} has been kicked by {ctx.message.author} for {reason}!**", color=0x40DA27)
        await ctx.send(embed=embed)
        user = member
        kick=Embed(title="AkumaKick", url="https://www.lunarclient.com/", description=f"**You have been kicked by {ctx.message.author} for {reason}!**", color=0x40DA27)
        await user.send(embed=kick)
        print(f"Kicked {member.name} from {ctx.guild.name}")
    @commands.command(name="ban")
    @commands.has_permissions(ban_members=True)
    async def ban(self, ctx, member : discord.Member, *, reason=None):
        await member.ban(reason=reason)
        embed=Embed(title="AkumaBan", url="https://www.lunarclient.com/", description=f"**{member.name} has been banned by {ctx.message.author} for {reason}!**", color=0x40DA27)
        await ctx.send(embed=embed)
        user = member
        ban=Embed(title="AkumaBan", url="https://www.lunarclient.com/", description=f"**You have been banned by {ctx.message.author} for {reason}!**", color=0x40DA27)
        await user.send(embed=ban)
        print(f"Banned {member.name} from {ctx.guild.name}")
    @commands.command(name="unban")
    @commands.has_permissions(ban_members=True)
    async def unban(ctx, *, user=None):

        try:
            user = await commands.converter.UserConverter().convert(ctx, user)
        except:
            await ctx.send("Error: User could not be found!")
            return

        try:
            bans = tuple(ban_entry.user for ban_entry in await ctx.guild.bans())
            if user in bans:
                await ctx.guild.unban(user, reason="Responsible moderator: "+ str(ctx.author))
            else:
                await ctx.send("User is not banned!")
                return

        except discord.Forbidden:
            await ctx.send("Client does not have permission to unban!")
            return

        except:
            await ctx.send("Unbanning failed!")
            return

        await ctx.send(f"Successfully unbanned {user.mention}!")
        print(f"Unbanned {user} from {ctx.guild.name}.")

    @commands.command(name="clear", aliases=["purge", "delete"])
    @commands.has_permissions(manage_messages=True)
    async def clear(self, ctx, amount: int):
        if amount == None:
            await ctx.channel.purge(limit=10000)
            
        else:
            await ctx.channel.purge(limit=amount+1)
            embed=discord.Embed(title="Akuma-Clear", url="https://www.lunarclient.com/", description=f"**I have deleted {amount} message(s)!**", color=0x40DA27)
            await ctx.send(embed=embed, delete_after = 10)
            print(f"{ctx.guild.name}: Deleted {amount} messages!")
         
    @commands.command(name="say")
    @commands.has_permissions(administrator=True)
    async def say(self, ctx, *args):
	    response = ""

	    for arg in args:
		    response = response + " " + arg

	    await ctx.channel.send(response), await ctx.message.delete()

    @commands.command(name="role", aliases=["addrole"])
    @commands.has_permissions(manage_roles=True)
    async def role(self, ctx, user: discord.Member, role: discord.Role):
        if ctx.author.guild_permissions.administrator:
            await user.add_roles(role)
            await ctx.message.add_reaction(check)
        else:
            embed=discord.Embed(description="**You can't do that!:x: You are lacking the permission!**", color=0x40DA27)
            await ctx.send(embed=embed)


    @commands.command(name="roleall")
    @commands.has_permissions(manage_roles=True)
    async def roleall(self, ctx, role : discord.Role):
        for member in ctx.guild.members:
            await member.add_roles(role)
            await ctx.message.add_reaction(check)

    @commands.command(name="remroleall", aliases=["removeroleall", "rra"])
    @commands.has_permissions(manage_roles=True)
    async def remroleall(self, ctx, role : discord.Role):
        for member in ctx.guild.members:
            await member.remove_roles(role)
            await ctx.message.add_reaction(check)

    @commands.command(name="removerole", aliases=["remrole", "roleremove"])
    @commands.has_permissions(manage_roles=True)
    async def removerole(self, ctx, user: discord.Member, *, role: discord.Role):
        await user.remove_roles(role)
        await ctx.message.add_reaction(check)

    @commands.command(name="prefix")
    async def prefix(self, ctx, prefix):
        with open("prefixes.json", "r") as f:
                prefixes =json.load(f)

        prefixes[str(ctx.guild.id)] = prefix

        with open("prefixes.json", "w") as f:
            json.dump(prefixes, f, indent=4)
        await ctx.message.add_reaction(check)
        embed=discord.Embed(title="Prefix changed:", url="https://www.lunarclient.com/", description= f"(Guild: {ctx.guild.id}//{ctx.guild.name}) (New preifx: {prefix})", color=0x40DA27)
        await ctx.send(embed=embed)
        print(f"Prefix changed: (Guild: {ctx.guild.id}//{ctx.guild.name}) (New preifx: {prefix})")

    @commands.command(name="guildid", pass_context=True)
    async def guildid(self, ctx):
        id = ctx.message.guild.id
        await ctx.send(f"{id}")
        print(f"GetGuild: Command executed by: {ctx.author}, {ctx.guild.id}//{ctx.guild.name}")

    @commands.command(name="slowmode")
    @commands.has_permissions(manage_channels=True)
    async def slowmode(self, ctx, seconds: int):
        await ctx.channel.edit(slowmode_delay=seconds)
        embed=discord.Embed(title="Slowmode:", url="https://www.lunarclient.com/", description= f"**Slowmode is now at {seconds} seconds.**", color=0x40DA27)
        await ctx.send(embed=embed)
        


def setup(client):
    client.add_cog(ModCommands(client))

# Github: https://github.com/SearchAvocado\n Discord: Avocado#2878
# kick, ban, unban # Github: https://github.com/SearchAvocado\n Discord: Avocado#2878