From 3a9bb107aa6672df31e644c8dd828f2bf70cad7a Mon Sep 17 00:00:00 2001 From: fzorb Date: Wed, 9 Oct 2024 10:51:54 +0300 Subject: [PATCH] add ;days thingy --- bot.rb | 6 +++++- systems/misc.rb | 13 +++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 systems/misc.rb diff --git a/bot.rb b/bot.rb index b981025..54a2f7d 100644 --- a/bot.rb +++ b/bot.rb @@ -25,7 +25,10 @@ bot.command :help do |event, *message| ``` ;ip - 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 - 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 diff --git a/systems/misc.rb b/systems/misc.rb new file mode 100644 index 0000000..a4f5211 --- /dev/null +++ b/systems/misc.rb @@ -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