-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.lua
42 lines (36 loc) · 956 Bytes
/
config.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
local commands = require 'commands'
--
-- Configuration file, loaded once at start of execution
-- Variables indexed by _ are directly accessed by the host app
--
-- Target channel name
_channel = "necros"
-- Bot account name and oauth token
_botname = "coachme_bot"
_oauth = "u8pf2yy60tckz4enope5555474tzmu"
-- Users allowed to interact with the bot. 'all' allows everyone in chat.
_users = {"all", "rtchoke", "torene33"}
--
--
-- Function called by Host
function _process_message(host, usr, msg)
local command = msg:match("^!(%w+)")
if not command then
return
end
if command == "reload" then
commands = require 'commands'
end
if commands[command] then
local args = msg:match("^!%w+ (%.+)")
if validate(args) then
commands[command](host, usr, args)
end
end
end
--
-- TODO
-- Input validation to avoid malicious code injection
function validate(msg)
return true
end