Nestor

Mon petit bot Discord
Log | Files | Refs

commit 9d9f259976e53748027d4f34353e22ae56e2593d
parent 8af53d5f4a9fc5911aba9a29c64132a26f1b0f67
Author: Doshirae <doshirae@doshirae.fr>
Date:   Tue,  6 Nov 2018 23:03:49 +0100

Command: pinned

Diffstat:
Nestor.rb | 21+++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/Nestor.rb b/Nestor.rb @@ -12,6 +12,15 @@ $ALLOWED = { nico: 447878477044121620, hugo: 447867234371764249 } + +$IDS = { + 164258114068021248 => "Romain", + 447878477044121620 => "Nicolas", + 447867234371764249 => "Hugo", + 164014901285748737 => "Andreas", + 164035566722220033 => "Pierre", + 164017689457590272 => "Thomas" +} # 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. bot = Discordrb::Commands::CommandBot.new token: configatron.token, client_id: 261161348124114945, prefix: '!' @@ -113,13 +122,21 @@ end # }}} # xkcd {{{ bot.command(:xkcd, description: "Renvoie une page XKCD") do |event, num| - # "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 url = xkcd(num) event.channel.send_file File.new('xkcd.png'), caption: url `rm xkcd.png` end # }}} +# pinned remind {{{ +bot.command(:pinned, description: "Rappelle les messages pinned") do |event, num| + event.channel.pins.each do |pin| + event << "#{$IDS[pin.author.id]} — #{pin.timestamp.strftime('%d/%m/%Y')}" + event << pin.content + event << "-"*20 + end + nil +end +# }}} # dl {{{ bot.command(:dl) do |event, uri| require "net/http"