This repository has been 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
170 lines (154 loc) · 5.28 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
local discordia = require("discordia")
local client = discordia.Client()
--[[
Insert here your bot user token.
]]
local botToken = "<INSERT BOT TOKEN HERE>"
client:on("ready", function() -- bot is ready
client:setGame("Type !dev for info")
end)
client:on("memberJoin", function(member)
-- Check if the username contains a user tag
if string.match(member.user.username, '#%d%d%d%d') then
--[[
Contact user to inform that they can contact the server owner
]]
member.user:send({
embed = {
title = "You got banned!",
description = [[I am sorry but I had to ban you because you had a Discord username in your username. If you think that was a mistake, please contact the server owner.]],
fields = {
{
name = "Guild Owner mention:",
value = member.guild.owner.user.mentionString,
inline = true
},
{
name = "Guild Owner tag:",
value = member.guild.owner.user.tag,
inline = true
}
},
footer = {
text = member.guild.name
},
color = 0xFF0000 -- hex color code
}})
--[[
Contact guild owner about the ban
]]
member.guild.owner.user:send({
embed = {
title = "A user got banned by me",
description = [[I have banned a user for having a link in their username.]],
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
}})
--[[
Actually ban the user
]]
member.guild:banUser(member.user, "Discord tag in username", 1)
-- Check if the username contains a link
elseif string.match(member.user.username, '.*%..*%/.*') then
--[[
Contact user to inform that they can contact the server owner
]]
member.user:send({
embed = {
title = "You got banned!",
description = [[I am sorry but I had to ban you because you had a link in your username. If you think that was a mistake, please contact the server owner.]],
fields = {
{
name = "Guild Owner Mention:",
value = member.guild.owner.user.mentionString,
inline = true
},
{
name = "Guild Owner Tag:",
value = member.guild.owner.user.tag,
inline = true
}
},
footer = {
text = member.guild.name
},
color = 0xFF0000 -- hex color code
}})
--[[
Contact guild owner about the ban
]]
member.guild.owner.user:send({
embed = {
title = "A user got banned by me",
description = [[I have banned a user for having a link in their username.]],
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
}})
--[[
Actually ban the user
]]
member.guild:banUser(member.user, "Link in username", 1)
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