Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local channels = {}
- local users = {}
- local npt = print
- local accesswhitelist = {"N".."ia", "Cru".."or", "Kilo".."byte", "Ke".."vin_", "Clo".."udy", "dan".."200", "Stary".."2001", "AfterLife".."Lochie", "Du".."cky"}
- --nnxt = next
- --hide = {nnxt = true, hide = true, accesswhitelist = true, npt = true, users = true, channels = true}
- function iswlisted(user)
- for _, v in ipairs(accesswhitelist) do
- if v:lower() == user:lower() then return true end
- end
- return false
- end
- function print(...)
- if (not (channels[irc_channel] or users[irc_nick])) or iswlisted(irc_nick) then
- npt(...)
- end
- end
- local function muteu(u)
- if not iswlisted(irc_nick) then return end
- if iswlisted(u) then
- npt(u.." can not be muted")
- else
- if users[u] then
- npt(u.."is already muted.")
- return
- end
- users[u] = true
- npt("Locked outputs for "..u)
- end
- end
- local function mutec()
- if not iswlisted(irc_nick) then return end
- if channels[irc_channel] then
- npt("Already muted in "..irc_channel)
- return
- end
- channels[irc_channel] = true
- npt("Now muted in "..irc_channel)
- end
- function mute(user)
- if iswlisted(irc_nick) then
- if user then
- muteu(user)
- else
- mutec()
- end
- else
- error("Access denied")
- end
- end
- local function umuteu(user)
- if not iswlisted(irc_nick) then return end
- if not users[user] then
- npt(user.." is not muted")
- return
- end
- users[user] = nil
- npt("Unmuted "..user)
- end
- local function umutec()
- if not iswlisted(irc_nick) then return end
- if not channels[irc_channel] then
- npt("Not muted.")
- return
- end
- channels[irc_channel] = nil
- npt("Unmuted in "..irc_channel)
- end
- function unmute(user)
- if iswlisted(irc_nick) then
- if user then
- umuteu(user)
- else
- umutec()
- end
- else
- error("Access denied")
- end
- end
- function wladd(user)
- if iswlisted(irc_nick) then
- if iswlisted(user) then
- npt(user.." is already whitelisted")
- else
- table.insert(accesswhitelist, user)
- npt(user.." added to whitelist")
- end
- else
- error("Access denied")
- end
- end
- local function getwlindex(user)
- for k, v in ipairs(accesswhitelist) do
- if v:lower() == user:lower() then
- return k
- end
- end
- return nil
- end
- function wlrem(user)
- if iswlisted(irc_nick) then
- if user == irc_nick then
- npt("You can't un-whitelist yourself")
- elseif iswlisted(user) then
- table.remove(accesswhitelist, getwlindex(user))
- npt(user.." removed from whitelist")
- else
- npt(user.." is not whitelisted")
- end
- else
- error("Access denied")
- end
- end
- --[[function hide(...)
- local a = {...}
- for k, v in a do
- _G[a] = nil
- end
- end
- function irc_command(from, chan, cmd)
- irc_nick = from
- irc_channel = chan
- if cmd == "mute" then mutec()
- elseif cmd:sub(1, 5) == "mute " then mute(cmd:sub(6))
- elseif cmd == "unmute" then mutec()
- elseif cmd:sub(1, 7) == "unmute " then unmute(cmd:sub(8))
- elseif cmd:sub(1, 6) == "wladd " then wladd(cmd:sub(7))
- elseif cmd:sub(1, 6) == "wlrem " then wlrem(cmd:sub(7))
- end
- end
- function next(table, index)
- while true do
- k, v = nnxt(table, index)
- if key == nil or not table.hide[k] then return k, v end
- end
- end--]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement