blob: 627ca90ff0486c5cc5c16ea901c32fda85ad03c7 (
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
|
module Dinobot
module Core
class MessageInfo
attr_accessor :user, :channel, :message, :response
def initialize(user, channel, message)
@user = user
@channel = channel
@message = message
@response = []
end
def respond(arr)
raise "response not array -- #{arr}" unless arr.is_a?(Array)
case arr.first
when :say
raise "wrong number of arguments -- #{arr}" unless arr.length == 3
when :join, :part, :quit
raise "wrong number of arguments -- #{arr}" unless arr.length == 2
else
raise "unknown method name -- #{arr}"
end
@response << arr
end
end
end
end
|