This repository has been archived by the owner on May 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some misc commands. 8ball, coinflip, isup, choose, and qr code.
- Loading branch information
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
module Misc | ||
extend Discordrb::Commands::CommandContainer | ||
|
||
command(:isup, min_args: 1, max_args: 1) do |event, url| | ||
response = RestClient.get("http://downforeveryoneorjustme.com/#{url}") | ||
|
||
status = response.body.include?('It\'s just you') | ||
|
||
ups = ['You need to fix your internet, because', "Listen here, it's not my fault your internet sucks,", 'Get a good web browser, like Firefox!', "Why are you asking me if it's up?"].sample | ||
downs = ['Dang, that website has some bad uptime.', "Let's cheer this website up"].sample | ||
begin | ||
event.channel.send_embed do |e| | ||
e.title = "Website Up Analysis for #{url}" | ||
if status | ||
e.description = "#{ups} #{url} is **Up**!" | ||
e.color = '00FF00' | ||
else | ||
e.description = "#{downs} #{url} is **Down!**" | ||
e.color = 'FF0000' | ||
end | ||
end | ||
rescue Discordrb::Errors::NoPermission | ||
event.respond "SYSTEM ERRor, I CANNot SEND THE EMBED, EEEEE. Can I please have the 'Embed Links' permission? Thanks, appriciate ya." | ||
end | ||
end | ||
|
||
command(%i[eightball eball 8ball], min_args: 1) do |event, *question| | ||
question = question.join(' ') | ||
goodresponse = ['As I see it, yes', 'It is certain', 'It is decidedly so', 'Most likely', 'Outlook good', 'Signs point to yes', 'One would be wise to think so', 'Naturally', 'Without a doubt', 'Yes', 'You may rely on it', 'You can count on it'].sample.to_s | ||
neutralresponse = ['Better not tell you now!', 'Ask again later.', 'Cannot predict now', 'Cooldown enabled! Please try again.', 'Concentrate and ask again.', 'Rhetorical questions can be answered in solo', 'Maybe...'].sample.to_s | ||
badresponse = ['You\'re kidding, right?', 'Don\'t count on it.', 'In your dreams', 'My reply is no', 'Outlook not so good', 'My disclosed sources say NO', 'One would be wise to think not', 'Very doubtful'].sample.to_s | ||
response = rand(0..2) | ||
begin | ||
event.channel.send_embed do |e| | ||
e.title = ':question: Question' | ||
e.description = question | ||
if response.zero? | ||
idk = goodresponse | ||
e.color = '00FF00' | ||
elsif response == 1 | ||
idk = neutralresponse | ||
e.color = 'FFFF00' | ||
elsif response == 2 | ||
idk = badresponse | ||
e.color = 'FF0000' | ||
end | ||
e.add_field(name: ':8ball: 8ball says', value: idk, inline: false) | ||
end | ||
rescue Discordrb::Errors::NoPermission | ||
event.respond "SYSTEM ERRor, I CANNot SEND THE EMBED, EEEEE. Can I please have the 'Embed Links' permission? Thanks, appriciate ya." | ||
end | ||
end | ||
|
||
command(%i[qr qrcode], min_args: 1) do |event, *code| | ||
code = code.join(' ') | ||
begin | ||
event.channel.send_embed do |e| | ||
e.image = { url: URI.escape("https://api.qrserver.com/v1/create-qr-code/?data=#{code}&size=150x150&.png").to_s } | ||
end | ||
rescue Discordrb::Errors::NoPermission | ||
event.respond "SYSTEM ERRor, I CANNot SEND THE EMBED, EEEEE. Can I please have the 'Embed Links' permission? Thanks, appriciate ya." | ||
end | ||
end | ||
|
||
command(:flip) do |event| | ||
first = ['I flipped a coin, and it landed on', 'I threw the coin into the air and it finally landed on', 'I dropped the coin, it landed on'].sample | ||
headtails = %w[heads tails].sample | ||
begin | ||
event.channel.send_embed do |e| | ||
e.title = 'Coin Flip' | ||
e.description = "#{first} **#{headtails}**" | ||
end | ||
rescue Discordrb::Errors::NoPermission | ||
event.respond "SYSTEM ERRor, I CANNot SEND THE EMBED, EEEEE. Can I please have the 'Embed Links' permission? Thanks, appriciate ya." | ||
end | ||
end | ||
|
||
command(:choose, min_args: 1) do |event, *args| | ||
args = args.join(' ') | ||
args = args.split(',') | ||
event.respond args.sample | ||
end | ||
end |