-
Notifications
You must be signed in to change notification settings - Fork 0
/
moderation.py
34 lines (31 loc) · 1.33 KB
/
moderation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from discord import User
from discord.ext import commands
from discord_slash import cog_ext
from discord_slash.utils.manage_commands import create_permission
from discord_slash.model import SlashCommandPermissionType
from bot import slash
from discord_slash import SlashContext
class Moderation(commands.Cog):
def __init__(self, bot):
self.bot = bot
async def ban(self, ctx, member: User):
if type(ctx) == type(SlashContext):
if ctx.author.guild_permissions.ban_members:
await ctx.guild.ban(member)
await ctx.send("Banned {}".format(member), hidden=True)
else:
await ctx.send("You do not have permission to ban members", hidden=True)
else:
if ctx.author.guild_permissions.ban_members:
await ctx.guild.ban(member)
await ctx.send("Banned {}".format(member), hidden=True)
else:
await ctx.send("You do not have permission to ban members", hidden=True)
@commands.command(name="ban", category="Moderation")
async def ban_normal(self, ctx, member: User):
await self.ban(ctx, member)
@cog_ext.cog_slash(name="ban")
async def ban_slash(self, ctx, member: User):
await self.ban(ctx, member)
def setup(bot):
bot.add_cog(Moderation(bot))