-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathUserMod.py
More file actions
62 lines (56 loc) · 3.12 KB
/
Copy pathUserMod.py
File metadata and controls
62 lines (56 loc) · 3.12 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import discord, asyncio, time
from time import ctime
from discord.ext import commands
class UserMod:
def __init__(self, bot):
self.bot = bot
@commands.guild_only()
@commands.has_permissions(kick_members=True)
@commands.bot_has_permissions(kick_members=True)
@commands.command(aliases=['k'])
async def kick(self, ctx, user : discord.Member, *, reason=None):
if ctx.author.top_role > user.top_role or ctx.author == ctx.guild.owner:
if user == ctx.author:
return await ctx.send(f"**:no_entry: {user.mention} You can't kick yourself... just, leave the server?**")
await user.kick(reason=reason) # code s p a g e h t
if not reason:
msg = await ctx.send(f"**{user} was kicked :wave:**")
await msg.add_reaction("a:SpectrumOkSpin:466480898049835011")
await user.send(f"**You were kicked from {ctx.guild.name}**")
else:
msg = await ctx.send(f"**{user} was kicked :wave: Reason:** {reason}")
await msg.add_reaction("a:SpectrumOkSpin:466480898049835011")
await user.send(f"**You were kicked from {ctx.guild.name}. Reason:** {reason}**")
@commands.guild_only()
@commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
@commands.command(aliases=['b'])
async def ban(self, ctx, user : discord.Member, *, reason=None):
if ctx.author.top_role > user.top_role or ctx.author == ctx.guild.owner:
if user == ctx.author:
return await ctx.send(f"***:no_entry: {user.mention} You can't ban yourself... just, uninstall Discord?***")# very cool kanye, very cool
await user.ban(reason=reason)
if not reason:
msg = await ctx.send(f"**{user} was banned :hammer:**")
await msg.add_reaction("a:SpectrumOkSpin:466480898049835011")
else:
msg = await ctx.send(f"**{user} was banned :hammer: Reason:** {reason}")
await msg.add_reaction("a:SpectrumOkSpin:466480898049835011")
@commands.guild_only()
@commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
@commands.command(aliases=['sb'])
async def softban(self, ctx, user : discord.Member, *, reason=None):
if ctx.author.top_role > user.top_role or ctx.author == ctx.guild.owner:
if user == ctx.author:
return await ctx.send("***:no_entry: You can't softban yourself...***")
await user.ban(reason=reason)
await user.unban(reason=reason)
if not reason:
msg = await ctx.send(f"**{user} was softbanned :wave:**")
await msg.add_reaction("a:SpectrumOkSpin:466480898049835011")
else:
msg = await ctx.send(f"**{user} was softbanned :wave: Reason:** {reason}")
await msg.add_reaction("a:SpectrumOkSpin:466480898049835011")
def setup(bot):
bot.add_cog(UserMod(bot))