Class: Lita::Handlers::DiscordHelp

Inherits:
Object
  • Object
show all
Extended by:
Lita::Handler::ChatRouter
Defined in:
lib/lita/handlers/discord_help.rb

Instance Method Summary collapse

Instance Method Details

#help(response) ⇒ void

This method returns an undefined value.

Outputs help information about Lita commands.

Parameters:

  • response (Lita::Response)

    The response object.



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
# File 'lib/lita/handlers/discord_help.rb', line 21

def help(response)
  output = build_help(response)
  output = filter_help(output, response)
  first_message = true

  output = output.join("\n")

  messages = split_message(output)

  Lita.logger.debug(messages)

  messages.each { |message|
    if first_message
      response.reply_privately("```\n#{message}\n```")
      first_message = false
    else
      response.reply_privately("|||NOMENTION|||```\n#{message}\n```")
    end
  }

  if messages.length > 1
    response.reply_privately('Sorry for splitting that up in multiple messages, Discord doesn\'t allow me to send responses longer than 2000 characters :(')
  end

end