Module: Mchat::Command::Leave::InstanceMethods

Defined in:
lib/mchat/commands/leave.rb

Instance Method Summary collapse

Instance Method Details

#leave_command_runObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/mchat/commands/leave.rb', line 25

def leave_command_run
  if _current_nickname
    resp = _api.leave_channel( _current_channel , _current_nickname)
    code = resp.fetch("code")
    if code == StatusCode::Success
      _puts "#{_current_nickname} leave success.".style.primary
      _set_current_nickname  nil
    else
      _puts "leave request connect fail. try again.".style.warn
    end
  else
    _puts "You use leave".style.warn
  end
end

#leave_help_docObject



16
17
18
19
20
21
22
23
# File 'lib/mchat/commands/leave.rb', line 16

def leave_help_doc
  _puts %Q(
  #{"Help: Leave".style.bold}

  command: /leave
  explain: leave channel and delete your name.
  )
end