Nestor

Mon petit bot Discord
Log | Files | Refs

commit e068fd90a5db1f61c598072e34b2bfa0b5991d6a
parent 4ffe5f1a5529827347153e6c5cea7fb853fc0a0c
Author: Doshirae <doshirae@mailfence.com>
Date:   Sat, 18 Mar 2017 19:11:38 +0100

Added insult function

Diffstat:
nestor.rb | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/nestor.rb b/nestor.rb @@ -7,6 +7,7 @@ require 'nokogiri' require 'open-uri' require 'configatron' require_relative 'config.rb' +require_relative '../insultotron.rb' # This statement creates a bot with the specified token and application ID. After this line, you can add events to the # created bot, and eventually run it. @@ -116,6 +117,21 @@ bot.command(:poke, description: "Renvoie le nom, les évolutions, et les talents end # }}} +# Commande xkcd {{{ + +bot.command(:xkcd, description: "Renvoie une page XKCD") do |event, *args| + # "https://xkcd.com/#{num}" page = Nokogiri::HTML(open("https://xkcd.com/#{num}")) + isInt = Integer(args[0]) rescue nil + str = (args.size > 1) ? "Trop d'arguments, très cher" : (isInt) ? "https://xkcd.com/#{num}" : "Pas un entier" + event.respond(str) +end + +# }}} + +# insulte {{{ + `ruby ../insultotron.rb` +# }}} + # Réponses aux messages {{{ bot.message(containing: ['(╯°□°)╯︵ ┻━┻', '(ノಥ益ಥ)ノ ┻━┻', '(ノಠ益ಠ)ノ彡┻━┻']) do |event| event.respond '┬─┬ノ( º _ ºノ )'