Repository navigation
Expand file tree
/
Copy pathBan-script.lua
More file actions
91 lines (89 loc) · 2.81 KB
/
Copy pathBan-script.lua
File metadata and controls
91 lines (89 loc) · 2.81 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
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
local discordia = require("discordia")
local client = discordia.Client()
client:on("messageCreate", function(message)
local content = message.content
local author = message.author
discordia.extensions()
local client = message.client
local guild = message.guild
local args = message.content:split(" ")
local command = table.remove(args, 1)
local test = "tak"
if command == "!ban" then
local Member = message.member
if Member:hasPermission("banMembers") == true then
local nick = table.concat(args, " ")
local nicktwo = "test"
if nick and string.match(nick, "<@!%d+>") then
print("Zbanowano uzytkownika (pierwszym sposobem) ".. string.sub(nick, 4,-2))
nicktwo = string.sub(nick, 4,-2)
elseif nick and string.match(nick, "<@%d+>") then
print("Zbanowano uzytkownika (drugim sposobem) "..string.sub(nick, 3, -2))
nicktwo = string.sub(nick, 3, -2)
elseif nick and string.match(nick, "%d+") then
print("Zbanowano uzytkownika (trzecim sposobem) ".. string.match(nick, "%d+"))
nicktwo = string.match(nick, "%d+")
else test = "nie"
end
if test == "tak" then
local User = client:getUser(nicktwo)
User:send {
embed = {
title = "Zostałeś zbanowany !!!",
author = {
name = author.username,
icon_url = author.avatarURL
},
footer = {
text = "Stworzone przez kamexa"
},
color = 0xFF0000 -- kolor hex
}
}
guild:banUser(nicktwo)
message.channel:send {
embed = {
title = "Zbanowałem pomyślnie",
description = "Nick: ".. nick .."",
author = {
name = author.username,
icon_url = author.avatarURL
},
footer = {
text = "Stworzone przez kamexa"
},
color = 0x00ff00 -- kolor hex
}
}
elseif test == "nie" then
message.channel:send {
embed = {
title = "Niepoprawna nazwa użytkownika",
author = {
name = author.username,
icon_url = author.avatarURL
},
footer = {
text = "Stworzone przez kamexa"
},
color = 0xFF0000 -- kolor hex
}
}
end
else message.channel:send {
embed = {
title = "Nie posiadasz uprawnień do banowania",
author = {
name = author.username,
icon_url = author.avatarURL
},
footer = {
text = "Stworzone przez kamexa"
},
color = 0xFF0000 -- kolor hex
}
}
end
end
end)
client:run("Bot BOT_TOKEN") -- replace BOT_TOKEN with your bot token