Nestor

Mon petit bot Discord
Log | Files | Refs

commit 4a1357cb073e98a7ac06a5e9c793006d2f81d8e2
parent 576419f82cd705d4053a52faed144009d98f3577
Author: Doshirae <doshirae@mailfence.com>
Date:   Thu,  8 Jun 2017 19:01:20 +0200

Added eval command to test

Diffstat:
nestor.rb | 17++++++++++++++---
tags | 10+++++-----
2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/nestor.rb b/nestor.rb @@ -16,8 +16,8 @@ bot = Discordrb::Commands::CommandBot.new token: configatron.token, client_id: 2 # Commandes invite ==> bot.command(:invite, chain_usable: false) do |event| -# This simply sends the bot's invite URL, without any specific permissions, -# to the channel. + # This simply sends the bot's invite URL, without any specific permissions, + # to the channel. event.bot.invite_url end # <== @@ -52,7 +52,7 @@ bot.command(:dtc, description: "Renvoie une quote avec un certain numéro, ou un # latestQuote = file.gets # end # if num_quote <= latestQuote - "http://danstonchat.com/#{num_quote}.html" + "http://danstonchat.com/#{num_quote}.html" # else # "La quote existe pas fdp" # end @@ -121,6 +121,7 @@ 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}")) + # TODO : Recuperer l'image sur le site, et l'upload sur le chat 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) @@ -178,6 +179,16 @@ bot.message(containing: [/tg/i, /ta gueule/i]) do |event| end # <== +bot.command(:eval, help_available: false) do |event, *code| + # break unless event.user.id == 322417582424588289 # Replace number with your ID + + begin + eval code.join(' ') + rescue + 'An error occurred 😞' + end +end + # command taht mention # bot.mention do |event| # # The `pm` method is used to send a private message (also called a DM or direct message) to the user who sent the diff --git a/tags b/tags @@ -8,18 +8,18 @@ Dragodinde dd.rb /^class Dragodinde$/;" c Insulte insultotron.rb /^class Insulte$/;" c Main dd.rb /^class Main$/;" c Objet dd.rb /^class Objet$/;" c -adjectif insultotron.rb /^ def self.adjectif$/;" F class:Insulte.createMartine -animal insultotron.rb /^ def self.animal$/;" F class:Insulte.createMartine +adjectif insultotron.rb /^ def self.adjectif$/;" F class:Insulte +animal insultotron.rb /^ def self.animal$/;" F class:Insulte bonus dd.rb /^ def bonus(resistanceObjet)$/;" f createDefault insultotron.rb /^ def createDefault$/;" f class:Insulte -createHaddock insultotron.rb /^ def createHaddock$/;" f class:Insulte.createMartine +createHaddock insultotron.rb /^ def createHaddock$/;" f class:Insulte createKaaris insultotron.rb /^ def createKaaris$/;" f class:Insulte createMartine insultotron.rb /^ def createMartine$/;" f class:Insulte initialize dd.rb /^ def initialize(couleur, fatigue, nivCourantJauge)$/;" f class:Dragodinde initialize dd.rb /^ def initialize(drago, objet, frequence=2)$/;" f class:Main initialize dd.rb /^ def initialize(resistance=600, efficacite=30)$/;" f class:Objet initialize insultotron.rb /^ def initialize(mode)$/;" f class:Insulte -insultesHaddock insultotron.rb /^ def self.insultesHaddock$/;" F class:Insulte.createMartine -lieu insultotron.rb /^ def self.lieu$/;" F class:Insulte.createMartine +insultesHaddock insultotron.rb /^ def self.insultesHaddock$/;" F class:Insulte +lieu insultotron.rb /^ def self.lieu$/;" F class:Insulte temps dd.rb /^ def temps(jaugeVoulue)$/;" f class:Main to_s insultotron.rb /^ def to_s$/;" f class:Insulte