Nestor

Mon petit bot Discord
Log | Files | Refs

commit 61774e3aacd36a902538e7d1956e5986a4e9595c
parent 8196cf59efb68d35c495f0faab0c030ee2626321
Author: Doshirae <doshirae@lilo.org>
Date:   Wed,  8 Nov 2017 23:15:58 +0100

Indent was fucked

Diffstat:
Nestor.rb | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/Nestor.rb b/Nestor.rb @@ -1,5 +1,4 @@ #!/usr/bin/env ruby - require 'bundler/setup' Bundler.require(:default) @@ -142,15 +141,15 @@ bot.command(:strawpoll, description: "Créer un strawpoll", usage: "!strawpoll [ if choices.empty? event.respond "Mais enfin ! Quelle curieuse idée de faire un sondage sans le moindre choix... On se croirait en Russie" else - choices = choices.join(' ').split(' | ') - if choices[0] =~ /q\s.*/ - question = choices.shift[2..-1] + choices = choices.join(' ').split(' | ') + if choices[0] =~ /q\s.*/ + question = choices.shift[2..-1] + end + question ||= "Poll de #{event.user.name}" + json = HTTParty.post("https://strawpoll.me/api/v2/polls", body: {title: "#{question}", options: choices}.to_json).body + id = JSON.parse(json)["id"] + event.respond "Voici pour vous, mon cher\nhttps://strawpoll.me/#{id}" end - question ||= "Poll de #{event.user.name}" - json = HTTParty.post("https://strawpoll.me/api/v2/polls", body: {title: "#{question}", options: choices}.to_json).body - id = JSON.parse(json)["id"] - event.respond "Voici pour vous, mon cher\nhttps://strawpoll.me/#{id}" -end end # <==