blob: 0082260dfd7dc42a1541e93a090ed5417c7e2397 (
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.respond [:say, m.channel, @config[:trigger][:global]]
when 'debug'
m.respond [:say, m.channel, @config[: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[:trigger][:global] = val
@config.save
when 'debug'
case val
when 'true'
@config[:debug] = true
@config.save
when 'false'
@config[:debug] = false
@config.save
end
end
end
end
end
end
|