-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigtemplate.lua
121 lines (108 loc) · 3.11 KB
/
configtemplate.lua
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
permissions = {}
--insert host into permissions here
--example: permissions["Powder/Developer/cracker64"] = 101
--Owner should be 101, trusted global ops can be 100
--Set to -2 to ignore host
--Remember to escape .'s and other lua pattern special characters with %
--insert per channel permissions here (channel specific ops)
channelPermissions = {
--[[["##mychannel"] = {
["Powder/Developer/jacob1"] = 50,
},
--Give everyone a permission level of -1 by default
["##quietchannel"] = {
["@default"] = -1,
},]]
}
--to override the default permission level of a command, insert it here
commandPermissions = {
--["mycommand"] = 10,
}
--to override the default permission level of a command only in one channel, insert it here
channelCommandPermissions = {
--[[["##mychannel"] = {
["mycommand"] = 0,
},]]
}
-- Do not edit these functions. Go to the end of the file to configure the network settings
--Get perm value for part of a hostmask (usually just host)
function getPerms(host,chan)
local perms, chanPerms = -1/0, nil
for k,v in pairs(permissions) do
if host:match("^"..k.."$") then
if v < 0 then
perms = -1
break
elseif v > perms then
perms = v
end
end
end
if chan and channelPermissions[chan] then
for k,v in pairs(channelPermissions[chan]) do
if host:match("^"..k.."$") then
if v < 0 then
return -1
elseif v > (chanPerms or -1/0) then
chanPerms = math.min(v, 99)
end
end
end
end
if perms < -2 then perms=0 end
if chanPerms and chanPerms < -2 then chanPerms=0 end
if not chanPerms and channelPermissions[chan] and channelPermissions[chan]["@default"] then
if perms == 0 then return channelPermissions[chan]["@default"] end
return math.max(channelPermissions[chan]["@default"], perms)
end
return chanPerms or perms
end
function getCommandPerms(cmd,chan)
if not commands[cmd] then return 101 end --if this command doesn't exist, default to 101
local defaultlvl = commands[cmd].level
if defaultlvl >= 100 then return defaultlvl end
if chan and channelCommandPermissions[chan] then
return channelCommandPermissions[chan][cmd] or defaultlvl
end
return defaultlvl
end
--This has server specific data
local config = {
--Network to connect to, change to whatever network you use
network = {
server = "irc.libera.chat",
port = 6697,
--password = "",
ssl = true,
timeout = 30,
sasl = true
},
--User info, set these to whatever you need
user = {
nick = "FakeCrackbot",
username = "Meow",
realname = "moo",
--account = "Crackbot",
--password = "password"
},
--Owner info, only used now for terminal input
owner = {
nick = "jacob1",
host = "Powder/Developer/jacob1",
fullhost = "jacob1!~jacob1@Powder/Developer/jacob1"
},
--Channels to join on start
autojoin = {
--"##mychannel",
},
--only used in a small handful of places
primarychannel = "##mychannel",
--logs all commands done in pm, and added aliases
logchannel = "##logchannel",
prefix = "%./",
suffix = "moo+",
--turns on terminal input, can be used on linux to input commands directly from a second terminal
--terminal = "gnome-terminal -x",
--terminalinput = true
}
return config