Yessiest
2 years ago
10 changed files with 171 additions and 60 deletions
-
1.gitignore
-
6.gitmodules
-
33bot.lua
-
20libraries/classes/command.lua
-
1libraries/libraries/luaqalc
-
1libraries/luaqalc
-
10plugins/meta/init.lua
-
42plugins/reactions/init.lua
-
100plugins/security/init.lua
-
13plugins/tools/init.lua
@ -0,0 +1,6 @@ |
|||||
|
[submodule "libraries/libraries/luaqalc"] |
||||
|
path = libraries/libraries/luaqalc |
||||
|
url = https://512mb.org/git/Yessiest/luaqalculator |
||||
|
[submodule "libraries/luaqalc"] |
||||
|
path = libraries/luaqalc |
||||
|
url = https://512mb.org/git/Yessiest/luaqalculator |
@ -0,0 +1 @@ |
|||||
|
Subproject commit 5e1105631195255e8305fcaba6d37d167e9bd897 |
@ -0,0 +1,100 @@ |
|||||
|
local pluginc = import("classes.plugin") |
||||
|
local command = import("classes.command") |
||||
|
local sql = import("sqlite3") |
||||
|
local plugin = pluginc("help") |
||||
|
|
||||
|
local db = sql.open(server.config_path.."sec.sqlite") |
||||
|
|
||||
|
if not db:rowexec("SELECT name FROM sqlite_master WHERE type='table' AND name='infractions'") then |
||||
|
db:exec [[ |
||||
|
CREATE TABLE infractions(id INTEGER PRIMARY KEY AUTOINCREMENT, user TEXT, desc TEXT, action TEXT, timestamp INTEGER); |
||||
|
]] |
||||
|
end |
||||
|
|
||||
|
local grantrole = command("grant-role",{ |
||||
|
help = {embed={ |
||||
|
title = "Grant a role to the user", |
||||
|
description = "If <user> is not provided, the caller is assumed as the <user> argument.", |
||||
|
fields = { |
||||
|
{name = "Usage:",value = "grant-role <role id> [<user>]"}, |
||||
|
{name = "Perms:",value = "administrator"}, |
||||
|
{name = "Options:",value = "-q - quiet (don't print the result)"} |
||||
|
} |
||||
|
}}, |
||||
|
perms = { |
||||
|
"administrator" |
||||
|
}, |
||||
|
args = { |
||||
|
"role" |
||||
|
}, |
||||
|
exec = function(msg,args,opts) |
||||
|
return ((args[2] and msg.guild:getMember(args[2])) or msg.member):addRole(args[1]) |
||||
|
end |
||||
|
}) |
||||
|
plugin:add_command(grantrole) |
||||
|
|
||||
|
local revokerole = command("revoke-role",{ |
||||
|
help = {embed={ |
||||
|
title = "Revoke a role from the user", |
||||
|
description = "If <user> is not provided, the caller is assumed as the <user> argument.", |
||||
|
fields = { |
||||
|
{name = "Usage:",value = "revoke-role <role id> [<user>]"}, |
||||
|
{name = "Perms:",value = "administrator"}, |
||||
|
{name = "Options:",value = "-q - quiet (don't print the result)"} |
||||
|
} |
||||
|
}}, |
||||
|
perms = { |
||||
|
"administrator" |
||||
|
}, |
||||
|
args = { |
||||
|
"role" |
||||
|
}, |
||||
|
exec = function(msg,args,opts) |
||||
|
return ((args[2] and msg.guild:getMember(args[2])) or msg.member):removeRole(args[1]) |
||||
|
end |
||||
|
}) |
||||
|
plugin:add_command(revokerole) |
||||
|
|
||||
|
local warn = command("warn",{ |
||||
|
help = {embed={ |
||||
|
title = "Warn a user", |
||||
|
description = "nuff said.", |
||||
|
fields = { |
||||
|
{name = "Usage:",value = "warn <user> <reason>"}, |
||||
|
{name = "Perms:",value = "kick_members"}, |
||||
|
} |
||||
|
}}, |
||||
|
perms = { |
||||
|
"kick_members" |
||||
|
}, |
||||
|
args = { |
||||
|
"member", |
||||
|
"string" |
||||
|
}, |
||||
|
exec = function(msg,args,opts) |
||||
|
local warnst = db:prepare("INSERT INTO infractions VALUES(NULL, ?,?,?, date())") |
||||
|
warnst:reset():bind(tostring(args[1].id),args[2],"warn"):step() |
||||
|
local countst = db:prepare("SELECT COUNT(*) FROM infractions WHERE user=?") |
||||
|
local v = countst:reset():bind(tostring(args[1].id)):step() |
||||
|
msg:reply({embed = { |
||||
|
title = "User has been warned successfully", |
||||
|
description = args[1].name.." has been given out a warning.", |
||||
|
fields = { |
||||
|
{ name = "Warning count: ", value = tostring(tonumber(v[1])) }, |
||||
|
{ name = "Reason: ", value = args[2] }, |
||||
|
{ name = "Timestamp: ", value = os.date("%a %b %e %H:%M:%S %Y",os.time(os.date("!*t"))) } |
||||
|
}, |
||||
|
}}) |
||||
|
end |
||||
|
}) |
||||
|
plugin:add_command(warn) |
||||
|
--[[ |
||||
|
local infractions = command("infractions", { |
||||
|
help = { embed = { |
||||
|
title = "List user infractions", |
||||
|
description = "Infractions include kicks, bans, mutes and warnings." |
||||
|
fields = { |
||||
|
{name = "Usage: ", value = "infractions <user> [<page>]"}, |
||||
|
{name = "Perms: ", value = "kick_members"}, |
||||
|
]] |
||||
|
return plugin |
Write
Preview
Loading…
Cancel
Save
Reference in new issue