Class: Commands
- Inherits:
-
Object
- Object
- Commands
- Defined in:
- lib/burroughs/commands/commands.rb
Instance Method Summary collapse
-
#initialize ⇒ Commands
constructor
A new instance of Commands.
- #register ⇒ Object
Constructor Details
#initialize ⇒ Commands
Returns a new instance of Commands.
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/burroughs/commands/commands.rb', line 4 def initialize @cmds = [ { name: :ping, desc: "Are you awake?" }, { name: :clear, desc: "Clear messages in the current channel (max 100).", params: [ { type: "integer", name: "size", desc: "Number of messages to clear.", required: true } ] }, { name: :invite, desc: "Generate an invite link.", params: [ { type: "string", name: "username", desc: "Automatically PM the invite to the specified user.", required: false } ] } ] end |
Instance Method Details
#register ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/burroughs/commands/commands.rb', line 18 def register @cmds.each do |c| if c.params.nil? bot.register_application_command(c.name, c.desc) else bot.register_application_command(c.name, c.desc) do |cmd| c.params.each do |p| cmd.send(type, p.name, p.desc, required: p.required) end end end end end |