-
Notifications
You must be signed in to change notification settings - Fork 3
/
mod.py
276 lines (255 loc) · 14.8 KB
/
mod.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
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
import discord
from datetime import datetime
from discord.utils import get
async def msg(message, x, p, self):
msg = x
hasperms = False
cmd = message.split()
validcommands = [p + "hackban", p + "ban", p + "kick", p + "mute", p + "warn", p+ "clear", p+"unmute", p+ "approve"]
if not cmd[0].lower() in validcommands:
return
if message.startswith(p + "hackban"):
if msg.author.guild_permissions.ban_members:
hasperms = True
if not hasperms:
embed = discord.Embed(title = "No Permissions!", description = "You do not have permission to run " + message + " in " + msg.guild.name, color=0x00ff00)
embed.set_thumbnail(url = "https://freeiconshop.com/wp-content/uploads/edd/cross-flat.png")
await msg.author.send(embed = embed)
return
params = message.split()
bannedusers = 0
for users in params:
if users == "!hackban":
print("no user")
else:
bannedusers = bannedusers +1
print(users)
user = await self.fetch_user(int(users))
await msg.guild.ban(user)
channel = get(x.guild.channels, name="case_logs", type=discord.ChannelType.text)
embed = discord.Embed(title = "Ban!", description = "<@" + str(msg.author.id) + "> has hackbanned " + str(bannedusers) + " users!\n" + message , color=0x00ff00)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
if message.startswith(p + "ban"):
if msg.author.guild_permissions.ban_members:
hasperms = True
if not hasperms:
embed = discord.Embed(title = "No Permissions!", description = "You do not have permission to run " + message + " in " + msg.guild.name, color=0x00ff00)
embed.set_thumbnail(url = "https://freeiconshop.com/wp-content/uploads/edd/cross-flat.png")
await msg.author.send(embed = embed)
return
channel = get(x.guild.channels, name="case_logs", type=discord.ChannelType.text)
if not x.mentions:
await x.delete()
params = message.split()
for users in params:
if users == "!ban":
print("no user")
else:
user = await self.fetch_user(int(users))
if user.id == msg.author.id:
return
embed = discord.Embed(title = "Ban!", description = "<@" + str(msg.author.id) + "> has banned <@" + str(user.id) + ">!\n" + message , color=0x00ff00)
await user.send("You have been banned from " + msg.guild.name + "\nThe reasoning can be found below: \n\n" + message)
await msg.guild.ban(user)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
for member in x.mentions:
print(member)
embed = discord.Embed(title = "Ban!", description = "<@" + str(msg.author.id) + "> has banned <@" + str(member.id) + ">!\n" + message , color=0x00ff00)
if member.id == msg.author.id:
return
await member.send("You have been banned from " + msg.guild.name)
await msg.guild.ban(member)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
if message.startswith(p + "clear"):
if msg.author.guild_permissions.kick_members:
hasperms = True
if hasperms == False:
embed = discord.Embed(title = "No Permissions!", description = "You do not have permission to run " + message + " in " + msg.guild.name, color=0x00ff00)
embed.set_thumbnail(url = "https://freeiconshop.com/wp-content/uploads/edd/cross-flat.png")
await msg.author.send(embed = embed)
return
mess = message.split(" ")
mess[1] = int(mess[1]) + 1
if int(mess[1]) > 100:
mess[1] = 100
if int(mess[1]) < 2:
mess[1] = 2
await msg.channel.purge(limit= int(mess[1]))
channel = get(x.guild.channels, name="case_logs", type=discord.ChannelType.text)
await channel.send(str(mess[1]) + " messages removed from #" + msg.channel.name)
if message.startswith(p + "kick"):
if msg.author.guild_permissions.kick_members:
hasperms = True
if hasperms == False:
embed = discord.Embed(title = "No Permissions!", description = "You do not have permission to run " + message + " in " + msg.guild.name, color=0x00ff00)
embed.set_thumbnail(url = "https://freeiconshop.com/wp-content/uploads/edd/cross-flat.png")
await msg.author.send(embed = embed)
return
channel = get(x.guild.channels, name="case_logs", type=discord.ChannelType.text)
if not x.mentions:
await x.delete()
params = message.split()
for users in params:
if users == "!kick":
print("no user")
else:
user = await self.fetch_user(int(users))
if user.id == msg.author.id:
return
embed = discord.Embed(title = "Kick!", description = "<@" + str(msg.author.id) + "> has kicked <@" + str(user.id) + ">!\n" + message , color=0x00ff00)
await user.send("You have been kicked from " + msg.guild.name)
await msg.guild.kick(user)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
for member in x.mentions:
print(member)
embed = discord.Embed(title = "Kick!", description = "<@" + str(msg.author.id) + "> has kicked <@" + str(member.id) + ">! \n\n**" + message + "**" , color=0x00ff00)
if member.id == msg.author.id:
return
await member.send("You have been kicked from " + msg.guild.name + "\nThe reasoning can be found below: \n\n" + message)
await msg.guild.kick(member)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
if message.startswith(p + "approve"):
if msg.author.guild_permissions.kick_members:
hasperms = True
if hasperms == False:
embed = discord.Embed(title = "No Permissions!", description = "You do not have permission to run " + message + " in " + msg.guild.name, color=0x00ff00)
embed.set_thumbnail(url = "https://freeiconshop.com/wp-content/uploads/edd/cross-flat.png")
await msg.author.send(embed = embed)
return
if not x.mentions:
await x.delete()
params = message.split()
for users in params:
if users == "!approve":
print("no user")
else:
user = x.guild.get_member(int(users))
role = get(x.guild.roles, name="New Floof")
await user.remove_roles(role)
role = get(x.guild.roles, name="Verified Floof")
await user.add_roles(role)
await x.channel.send("Approved")
for member in x.mentions:
role = get(x.guild.roles, name="New Floof")
await member.remove_roles(role)
role = get(x.guild.roles, name="Verified Floof")
await member.add_roles(role)
await x.channel.send("Approved")
if message.startswith(p + "warn"):
if msg.author.guild_permissions.kick_members:
hasperms = True
if hasperms == False:
embed = discord.Embed(title = "No Permissions!", description = "You do not have permission to run " + message + " in " + msg.guild.name, color=0x00ff00)
embed.set_thumbnail(url = "https://freeiconshop.com/wp-content/uploads/edd/cross-flat.png")
await msg.author.send(embed = embed)
return
channel = get(x.guild.channels, name="case_logs", type=discord.ChannelType.text)
if not x.mentions:
await x.delete()
params = message.split()
for users in params:
if users == "!warn":
print("no user")
else:
user = await self.fetch_user(int(users))
if user.id == msg.author.id:
return
embed = discord.Embed(title = "Warn!", description = "<@" + str(msg.author.id) + "> has warned <@" + str(user.id) + ">!\n" + message , color=0x00ff00)
await user.send("You have been warned on " + msg.guild.name + "\nThe reasoning can be found below: \n\n" + message)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
for member in x.mentions:
print(member)
embed = discord.Embed(title = "Warn!", description = "<@" + str(msg.author.id) + "> has warned <@" + str(member.id) + ">! \n\n**" + message + "**", color=0x00ff00)
if member.id == msg.author.id:
return
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await member.send("You have been warned on " + msg.guild.name + "\nThe reasoning can be found below: \n\n" + message)
await channel.send(embed = embed)
if message.startswith(p + "mute"):
if msg.author.guild_permissions.kick_members:
hasperms = True
if hasperms == False:
embed = discord.Embed(title = "No Permissions!", description = "You do not have permission to run " + message + " in " + msg.guild.name, color=0x00ff00)
embed.set_thumbnail(url = "https://freeiconshop.com/wp-content/uploads/edd/cross-flat.png")
await msg.author.send(embed = embed)
return
channel = get(x.guild.channels, name="case_logs", type=discord.ChannelType.text)
if not x.mentions:
await x.delete()
params = message.split()
for users in params:
if users == "!mute":
print("no user")
else:
user = x.guild.get_member(int(users))
if user.id == msg.author.id:
return
embed = discord.Embed(title = "Mute!", description = "<@" + str(msg.author.id) + "> has muted <@" + str(user.id) + ">!\n" + message , color=0x00ff00)
if x.guild.id == 725201209358549012:
role = get(x.guild.roles, name="Verified Floof")
await user.remove_roles(role)
role = get(x.guild.roles, name="Muted")
await user.add_roles(role)
await user.send("You have been muted on " + msg.guild.name + "\nThe reasoning can be found below: \n\n" + message)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
for member in x.mentions:
print(member)
embed = discord.Embed(title = "Muted!", description = "<@" + str(msg.author.id) + "> has muted <@" + str(member.id) + ">! \n\n**" + message + "**", color=0x00ff00)
if member.id == msg.author.id:
return
if x.guild.id == 725201209358549012:
role = get(x.guild.roles, name="Verified Floof")
await member.remove_roles(role)
role = get(member.guild.roles, name="Muted")
await member.add_roles(role)
await member.send("You have been muted on " + msg.guild.name + "\nThe reasoning can be found below: \n\n" + message)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
if message.startswith(p + "unmute"):
if msg.author.guild_permissions.kick_members:
hasperms = True
if hasperms == False:
embed = discord.Embed(title = "No Permissions!", description = "You do not have permission to run " + message + " in " + msg.guild.name, color=0x00ff00)
embed.set_thumbnail(url = "https://freeiconshop.com/wp-content/uploads/edd/cross-flat.png")
await msg.author.send(embed = embed)
return
channel = get(x.guild.channels, name="case_logs", type=discord.ChannelType.text)
if not x.mentions:
await x.delete()
params = message.split()
for users in params:
if users == "!unmute":
print("no user")
else:
user = x.guild.get_member(int(users))
if user.id == msg.author.id:
return
embed = discord.Embed(title = "Unmute!", description = "<@" + str(msg.author.id) + "> has unmuted <@" + str(user.id) + ">!\n" + message , color=0x00ff00)
if x.guild.id == 725201209358549012:
role = get(x.guild.roles, name="Verified Floof")
await user.add_roles(role)
role = get(x.guild.roles, name="Muted")
await user.remove_roles(role)
await user.send("You have been now been unmuted on " + msg.guild.name)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)
for member in x.mentions:
print(member)
embed = discord.Embed(title = "Unmuted!", description = "<@" + str(msg.author.id) + "> has unmuted <@" + str(member.id) + ">! \n\n**" + message + "**", color=0x00ff00)
if member.id == msg.author.id:
return
role = get(member.guild.roles, name="Muted")
if x.guild.id == 725201209358549012:
role = get(x.guild.roles, name="Verified Floof")
await user.add_roles(role)
await member.remove_roles(role)
await member.send("You have now been unmuted on " + msg.guild.name)
embed.set_thumbnail(url = "https://image.freepik.com/free-photo/judge-gavel-hammer-justice-law-concept_43403-625.jpg")
await channel.send(embed = embed)