diff --git a/libraries/.air.lua.swp b/libraries/.air.lua.swp new file mode 100644 index 0000000..8395dc9 Binary files /dev/null and b/libraries/.air.lua.swp differ diff --git a/plugins/roledefaults/init.lua b/plugins/roledefaults/init.lua new file mode 100644 index 0000000..506ba1b --- /dev/null +++ b/plugins/roledefaults/init.lua @@ -0,0 +1,38 @@ +local plugin_class = import("classes.plugin") +local command = import("classes.command") +local plugin = plugin_class("roledefaults") +config.default_roles = {} +client:on("memeberJoin",function(member) + for k,v in pairs(config.default_roles) do + member:addRole(v) + end +end) + +local droleadd = command("droleadd",{ + help = "Add a default role to assign for new users", + usage = "droleadd ", + args = { + "role" + }, + exec = function(msg,args,opts) + table.insert(config.default_roles,args[1].id) + end, +}) +local droledel = command("droledel",{ + help = "Remove a role from the list of default roles" + usage = "droledel ", + args = { + "role" + }, + exec = function(msg,args,opts) + for k,v in pairs(config.default_roles) do + if v == args[1].id then + table.remove(config.default_roles,k) + end + end + end +}) +plugin:add_command(droleadd) +plugin:add_command(droledel) +return plugin +