blob: 2bf8b0b917e97c9ae8db82ed61ccec6f2a5ebb3d (
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
50
51
52
53
|
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(user, channel, argument)
return unless @bot.modules[:admin].is_admin?(user)
case argument
when 'trigger'
[[:say, channel, @config.data[:trigger][:global]]]
when 'debug'
[[:say, channel, @config.data[:debug].to_s]]
else
nil
end
end
def set(user, channel, argument)
return unless @bot.modules[:admin].is_admin?(user)
key, val = argument.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
nil
end
end
end
end
|