This repository was archived by the owner on Oct 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathantispam.lua
173 lines (155 loc) · 5.36 KB
/
antispam.lua
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
local discordia = require("discordia")
local client = discordia.Client()
--[[
Insert here your bot user token.
]]
local botToken = "<INSERT BOT TOKEN>"
--[[
List of not allowed nickname content
If you want to add something, just add a new line like you see
IMPORTANT: Don't forget the ',' after each line
]]
local nickBlackList = {
"#%d%d%d%d",
".*%..*%/.*",
".*tweet.*"
}
function banMember(member)
local owner = {
["mention"] = "404 - Not Found",
["tag"] = "404 - Not Found"
}
--[[
Contact guild owner about the ban
]]
if member.guild.owner then
member.guild.owner.user:send({
embed = {
title = "A user got banned by me",
description = [[I have banned a user for looking like a SelfBot.]],
fields = {
{
name = "Banned User Mention:",
value = member.user.mentionString,
inline = true
},
{
name = "Banned User Tag:",
value = member.user.tag,
inline = true
}
},
footer = {
text = member.guild.name
},
color = 0xFF0000 -- hex color code
}})
owner["mention"] = member.guild.owner.user.mentionString
owner["tag"] = member.guild.owner.user.tag
elseif member.guild and member.guild.ownerId then
member.guild:getMember(member.guild.ownerId).user:send({
embed = {
title = "A user got banned by me",
description = [[I have banned a user for looking like a SelfBot.]],
fields = {
{
name = "Banned User Mention:",
value = member.user.mentionString,
inline = true
},
{
name = "Banned User Tag:",
value = member.user.tag,
inline = true
}
},
footer = {
text = member.guild.name
},
color = 0xFF0000 -- hex color code
}})
owner["mention"] = member.guild:getMember(member.guild.ownerId).user.mentionString
owner["tag"] = member.guild:getMember(member.guild.ownerId).user.tag
else
print("Could not contact owner of: "..member.guild.name.." - Error 404")
end
member.user:send({
embed = {
title = "You got banned!",
description = [[I am sorry but I had to ban you because you look like a SelfBot If you think that was a mistake, please contact the server owner.]],
fields = {
{
name = "Guild Owner mention:",
value = owner["mention"],
inline = true
},
{
name = "Guild Owner tag:",
value = owner["tag"],
inline = true
}
},
footer = {
text = member.guild.name
},
color = 0xFF0000 -- hex color code
}})
--[[
Actually ban the user
]]
member.guild:banUser(member.user, "Discord tag in username", 1)
end
client:on("ready", function() -- bot is ready
client:setGame("Type !dev for info")
end)
client:on("shardReady", function() -- bot is ready
print("I am member of: "..client.guilds:count().." Guilds!")
end)
client:on("guildCreate", function() -- bot is ready
print("[+] I am now member of: "..client.guilds:count().." Guilds!")
end)
client:on("guildDelete", function() -- bot is ready
print("[-] I am now member of: "..client.guilds:count().." Guilds!")
end)
client:on("memberJoin", function(member)
for k,v in pairs(nickBlackList) do
if string.match(member.user.username, v) then
banMember(member)
break
end
end
end)
--[[
Please give me this credit and dont delete it
]]
client:on("messageCreate", function(message)
local content = message.content
if content == "!dev" or content == "!info" or content == "!developer" then
message:reply({embed = {
title = "Developed by Aperture Development",
description = [[Hello, I am DiscordAntiSelfbotSpam and was developed by Aperture Development.]],
fields = {
{
name = "Our Website:",
value = "https://www.aperture-development.de/",
inline = true
},
{
name = "Our GitHub:",
value = "https://github.com/Aperture-Development/DiscordAntiSelfbotSpam",
inline = false
},
{
name = "Our GitLab:",
value = "https://gitlab.aperture-development.de/",
inline = false
},
},
footer = {
text = "This Bot is licenced under the GNU GENERAL PUBLIC LICENSE Version 3"
},
color = 0xFFFFFF -- hex color code
}})
end
end)
client:run("Bot "..botToken) -- replace BOT_TOKEN with your bot token