Sha256: fba1ec7c7510fc30aaab937a98b7aec88f17eea4db9cffacc2a42b476ce47d8e

Contents?: true

Size: 797 Bytes

Versions: 7

Compression:

Stored size: 797 Bytes

Contents

require 'elephrame'

Candy = [ 'M&Ms', 'Skittles', 'Twix', 'Candycorn' ]
Genders   = [ 'sweet', 'sour', 'bitter', 'creamy', 'umami' ]

# set the prefix and usage string for our bot
cmd_bot = Elephrame::Bots::Command.new '!', 'mention me with !candy to get candy, or !gender to get a gender'

# add in the candy command
cmd_bot.add_command 'candy' do |bot|
  bot.reply("here's some candy!
*gives you a #{Candy.sample}*",
            spoiler: 'candy')
end

# add in the gender command
cmd_bot.add_command 'gender' do |bot|
  bot.reply("here's a spare gender!
*gives you a #{Genders.sample} gender*",
            spoiler: 'gender shitpost')
end

# if the command is not found
cmd_bot.if_not_found do |bot|
  bot.reply("I didn't recognize that! Respond with !help to get usage info")
end

cmd_bot.run

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elephrame-0.5 examples/command.rb
elephrame-0.4.6 examples/command.rb
elephrame-0.4.5 examples/command.rb
elephrame-0.4.4 examples/command.rb
elephrame-0.4.3 examples/command.rb
elephrame-0.4.2 examples/command.rb
elephrame-0.4.1 examples/command.rb