Skip to content

Commit

Permalink
Sync your global bans with seed !
Browse files Browse the repository at this point in the history
use /sync_gbans to sync your global bans with seed
Also this function will ignore admins and the bot
  • Loading branch information
Imandaneshi committed Feb 18, 2016
1 parent a13c89b commit c8d1842
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion plugins/admin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,21 @@ local function run(msg,matches)
if matches[1] == "whois" then
user_info("user#id"..matches[2],user_info_callback,{msg=msg})
end
if matches[1] == "sync_gbans" then
if not is_sudo(msg) then-- Sudo only
return
end
local url = "http://seedteam.ir/Teleseed/Global_bans.json"
local SEED_gbans = http.request(url)
local jdat = json:decode(SEED_gbans)
for k,v in pairs(jdat) do
if not tonumber(v) == tonumber(our_id) and not is_admin2(v) then-- Ignore bot and admins :)
redis:hset('user:'..v, 'print_name', k)
redis:sadd('gbanned', v)
print(k, v.." Globally banned")
end
end
end
return
end
return {
Expand All @@ -183,7 +198,8 @@ return {
"^[!/](contactlist)$",
"^[!/](dialoglist)$",
"^[!/](delcontact) (%d+)$",
"^[!/](whois) (%d+)$"
"^[!/](whois) (%d+)$",
"^/(sync_gbans)$"--sync your global bans with seed
},
run = run,
}
Expand Down

0 comments on commit c8d1842

Please sign in to comment.