-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathadmin.lua
More file actions
41 lines (32 loc) · 668 Bytes
/
Copy pathadmin.lua
File metadata and controls
41 lines (32 loc) · 668 Bytes
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
local assert = assert
local ipairs = ipairs
module "ircbot"
local bot = _META
local loggedIn
local admins
function bot:reloadAdmins()
admins = self.config.admins or {}
loggedIn = {}
end
local function isAdmin(self, user)
local host = user.host
if loggedIn[host] == nil then
local info = self:whois(user.nick)
for k,accname in ipairs(admins) do
if accname == info.account then
loggedIn[host] = true
break
else
loggedIn[host] = false
end
end
end
return loggedIn[host]
end
function bot:initAdminSystem()
self:reloadAdmins()
self.isAdmin = isAdmin
end
function bot:hasAdminSystem()
return not self.config.no_admin_system
end