blob: fa3c1511ee50e9ad8d781d67d93b66250b2b9d8d (
plain) (
blame)
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
|
require_relative 'base'
require_relative '../core/config'
module Dinobot
module Module
class Config < Base
def initialize(bot)
super
@config = Dinobot::Core::Config.instance
@commands << :get << :set
end
def get(m, args)
return unless @bot.modules[:admin].is_admin?(m.user)
case args
when 'trigger'
m.response << [:say, m.channel, @config.data[:trigger][:global]]
when 'debug'
m.response << [:say, m.channel, @config.data[:debug].to_s]
end
end
def set(m, args)
return unless @bot.modules[:admin].is_admin?(m.user)
key, val = args.split(' ')
return unless val
case key
when 'trigger'
@config.data[:trigger][:global] = val
@config.save
when 'debug'
case val
when 'true'
@config.data[:debug] = true
@config.save
when 'false'
@config.data[:debug] = false
@config.save
end
end
end
end
end
end
|