add ;days thingy

This commit is contained in:
fzorb 2024-10-09 10:51:54 +03:00
parent 18cbfeb4de
commit 3a9bb107aa
2 changed files with 18 additions and 1 deletions

6
bot.rb
View File

@ -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. ;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 event.message.delete
nil nil
@ -39,4 +42,5 @@ bot.include! QuoteSystem
bot.include! NetworkModule bot.include! NetworkModule
bot.include! TriggerSystem bot.include! TriggerSystem
bot.include! StarboardSystem bot.include! StarboardSystem
bot.include! MiscModule
bot.run bot.run

13
systems/misc.rb Normal file
View 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