add ;days thingy
This commit is contained in:
parent
18cbfeb4de
commit
3a9bb107aa
6
bot.rb
6
bot.rb
@ -25,7 +25,10 @@ bot.command :help do |event, *message|
|
||||
```
|
||||
;ip <ips> - Display basic information about an IP address. You can input multiple IPs. We are required to state that the information provided by this command comes from the IP2Location database.
|
||||
```
|
||||
|
||||
**Miscellaneous**
|
||||
```
|
||||
;days <date in %d/%m/%Y format> - shows you the days until that date
|
||||
```
|
||||
")
|
||||
event.message.delete
|
||||
nil
|
||||
@ -39,4 +42,5 @@ bot.include! QuoteSystem
|
||||
bot.include! NetworkModule
|
||||
bot.include! TriggerSystem
|
||||
bot.include! StarboardSystem
|
||||
bot.include! MiscModule
|
||||
bot.run
|
||||
|
13
systems/misc.rb
Normal file
13
systems/misc.rb
Normal file
@ -0,0 +1,13 @@
|
||||
require 'discordrb'
|
||||
require 'date'
|
||||
|
||||
module MiscModule
|
||||
extend Discordrb::Commands::CommandContainer
|
||||
command :days do |event, *message|
|
||||
puts message[0]
|
||||
providedDate = Date.strptime(message[0], '%d/%m/%Y')
|
||||
dateToday = Date.today
|
||||
days = (providedDate - dateToday).to_i
|
||||
event.channel.send_message("#{days} days left until #{message[0]}")
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user