fixed rounding errors in mentions and channels for reminders

This commit is contained in:
Deukhoofd 2018-08-13 19:50:43 +02:00
parent 373809384f
commit d2d6b7824f
No known key found for this signature in database
GPG Key ID: B4C087AC81641654
1 changed files with 6 additions and 6 deletions

View File

@ -21,10 +21,10 @@ namespace DeukBot4.Database
db.SortedSetAddAsync("deukbot_reminders", (RedisValue)id, expectedTime.ToBinary()); db.SortedSetAddAsync("deukbot_reminders", (RedisValue)id, expectedTime.ToBinary());
db.HashSetAsync((RedisKey) id, new[] db.HashSetAsync((RedisKey) id, new[]
{ {
new HashEntry("channel", channel), new HashEntry("channel", channel.ToString()),
new HashEntry("message", message), new HashEntry("message", message),
new HashEntry("author", author), new HashEntry("author", author.ToString()),
new HashEntry("recipient", recipient), new HashEntry("recipient", recipient.ToString()),
}); });
} }
catch (Exception e) catch (Exception e)
@ -52,10 +52,10 @@ namespace DeukBot4.Database
string message = null; string message = null;
foreach (var hashEntry in data) foreach (var hashEntry in data)
{ {
if (hashEntry.Name == "channel") channel = (ulong) hashEntry.Value; if (hashEntry.Name == "channel") channel = ulong.Parse(hashEntry.Value);
else if (hashEntry.Name == "message") message = hashEntry.Value; else if (hashEntry.Name == "message") message = hashEntry.Value;
else if (hashEntry.Name == "author") author = (ulong) hashEntry.Value; else if (hashEntry.Name == "author") author = ulong.Parse(hashEntry.Value);
else if (hashEntry.Name == "recipient") recipient = (ulong) hashEntry.Value; else if (hashEntry.Name == "recipient") recipient = ulong.Parse(hashEntry.Value);
} }
var diff = time - DateTime.UtcNow; var diff = time - DateTime.UtcNow;
FireReminderAtTime((int) diff.TotalSeconds, channel, message, author, recipient); FireReminderAtTime((int) diff.TotalSeconds, channel, message, author, recipient);