@ -2,6 +2,7 @@
using Discord.Addons.Interactive ;
using Discord.Addons.Interactive ;
using Discord.Commands ;
using Discord.Commands ;
using Kehyeedra3.Services.Models ;
using Kehyeedra3.Services.Models ;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal ;
using System ;
using System ;
using System.Collections.Generic ;
using System.Collections.Generic ;
using System.Data ;
using System.Data ;
@ -103,15 +104,19 @@ namespace Kehyeedra3.Commands
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n{output+1}" ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n{output+1}" ) ;
}
}
[Command("remind"), Summary("Reminds you in a given time. (days, hours, minutes) Eg. 'remind 1 2 3 wash hands' would remind you in 1 day, 2 hours, 3 minutes to wash your hands")]
[Command("remind"), Summary("Reminds you in a given time. (days, hours, minutes) Eg. 'remind 1 2 3 wash hands' would remind you in 1 day, 2 hours, 3 minutes to wash your hands")]
public async Task Reminder ( ulong d , ulong h , ulong m , [ Remainder ] string r )
public async Task Reminder ( ulong d , ulong h , ulong m , [ Remainder ] string r = null )
{
{
DateTime dt = DateTime . UtcNow ;
string time = dt . ToString ( "dd/MM/yyyy HH:mm" ) ;
string remin = "" ;
string remin = "" ;
string refix = "" ;
string resuff = "" ;
ulong sen = ( d * 8 6 4 0 0 ) + ( h * 3 6 0 0 ) + ( m * 6 0 ) ;
ulong sen = ( d * 8 6 4 0 0 ) + ( h * 3 6 0 0 ) + ( m * 6 0 ) ;
ulong yeedraStamp = DateTime . UtcNow . ToYeedraStamp ( ) ;
ulong yeedraStamp = DateTime . UtcNow . ToYeedraStamp ( ) ;
if ( r = = null )
{
r = "Fill the text field next time you make a reminder." ;
}
while ( m > 5 9 )
while ( m > 5 9 )
{
{
h + = 1 ;
h + = 1 ;
@ -123,12 +128,48 @@ namespace Kehyeedra3.Commands
h - = 2 4 ;
h - = 2 4 ;
}
}
if ( d > 0 )
{
remin + = $" {d} day" ;
if ( d > 1 )
{
remin + = $"s" ;
}
}
if ( h > 0 )
{
remin + = $" {h} hour" ;
if ( h > 1 )
{
remin + = $"s" ;
}
}
if ( m > 0 )
{
remin + = $" {m} minute" ;
if ( m > 1 )
{
remin + = $"s" ;
}
}
if ( d = = 0 & & h = = 0 & & m = = 0 )
{
refix + = "right now" ;
resuff + = " just now" ;
}
else
{
refix + = "in" ;
resuff + = " ago" ;
}
if ( sen < 6 3 0 7 2 0 0 0 )
if ( sen < 6 3 0 7 2 0 0 0 )
{
{
var reminder = new Reminder
var reminder = new Reminder
{
{
UserId = Context . User . Id ,
UserId = Context . User . Id ,
Message = ( $"At **UTC {time}** you wanted me to remind you:\n**'{r}'**" ) ,
Message = $"**Reminder from{remin}{resuff}:**\n\n''{r}''" ,
Created = yeedraStamp ,
Created = yeedraStamp ,
Send = sen + yeedraStamp
Send = sen + yeedraStamp
} ;
} ;
@ -146,20 +187,7 @@ namespace Kehyeedra3.Commands
return ;
return ;
}
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n Ok, I'll remind you {refix}{remin}." ) ;
if ( d > 0 )
{
remin + = $" {d} days" ;
}
if ( h > 0 )
{
remin + = $" {h} hours" ;
}
if ( m > 0 )
{
remin + = $" {m} minutes" ;
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n Ok, I'll remind you in{remin}." ) ;
}
}
[Command("dab"), Summary("Dabs a person")]
[Command("dab"), Summary("Dabs a person")]