26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/mchat/commands/message.rb', line 26
def message_command_run(words)
if !_current_channel
_puts "You are not in channel, so you cannot message.".style.warn
_puts "type `/n[ame] <your name>` before chat".style.warn
elsif !_current_nickname
_puts "You must register a name to this channel".style.warn
_puts "type `/n[ame] <your name>` before chat".style.warn
elsif _current_channel && _current_nickname
resp = _api.create_channel_message(_current_channel, _current_nickname, words)
code = resp.fetch("code")
if code != StatusCode::Success
_puts warn "Send Message Fail:"
_puts "quote----"
_puts "#{words}"
_puts "---------"
else
_puts "send success"
end
end
end
|