mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-30 02:59:54 +03:00
Use DateTimeOffset#UtcNow instead of DateTimeOffset#Now (UtcNow is actually faster lol)
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
41958deb0a
commit
cdfa0e11f7
8 changed files with 28 additions and 21 deletions
|
@ -34,7 +34,7 @@ public sealed class BanCommand : ICommand {
|
|||
|
||||
var memberData = GuildData.Get(guild).MemberData[toBan.Id];
|
||||
memberData.BannedUntil
|
||||
= duration.TotalSeconds < 1 ? DateTimeOffset.MaxValue : DateTimeOffset.Now.Add(duration);
|
||||
= duration.TotalSeconds < 1 ? DateTimeOffset.MaxValue : DateTimeOffset.UtcNow.Add(duration);
|
||||
memberData.Roles.Clear();
|
||||
|
||||
cmd.ConfigWriteScheduled = true;
|
||||
|
|
|
@ -19,7 +19,7 @@ public sealed class MuteCommand : ICommand {
|
|||
if ((role is not null && toMute.Roles.Contains(role))
|
||||
|| (toMute.TimedOutUntil is not null
|
||||
&& toMute.TimedOutUntil.Value
|
||||
> DateTimeOffset.Now)) {
|
||||
> DateTimeOffset.UtcNow)) {
|
||||
cmd.Reply(Messages.MemberAlreadyMuted, ReplyEmojis.Error);
|
||||
return;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public sealed class MuteCommand : ICommand {
|
|||
var memberData = data.MemberData[toMute.Id];
|
||||
|
||||
if (role is not null) {
|
||||
memberData.MutedUntil = DateTimeOffset.Now.Add(duration);
|
||||
memberData.MutedUntil = DateTimeOffset.UtcNow.Add(duration);
|
||||
if (data.Preferences["RemoveRolesOnMute"] is "true") {
|
||||
memberData.Roles = toMute.RoleIds.ToList();
|
||||
memberData.Roles.Remove(cmd.Context.Guild.Id);
|
||||
|
|
|
@ -7,7 +7,8 @@ public sealed class PingCommand : ICommand {
|
|||
var builder = Boyfriend.StringBuilder;
|
||||
|
||||
builder.Append(Utils.GetBeep())
|
||||
.Append(Math.Round(Math.Abs(DateTimeOffset.Now.Subtract(cmd.Context.Message.Timestamp).TotalMilliseconds)))
|
||||
.Append(
|
||||
Math.Round(Math.Abs(DateTimeOffset.UtcNow.Subtract(cmd.Context.Message.Timestamp).TotalMilliseconds)))
|
||||
.Append(Messages.Milliseconds);
|
||||
|
||||
cmd.Reply(builder.ToString(), ReplyEmojis.Ping);
|
||||
|
|
|
@ -15,7 +15,7 @@ public sealed class RemindCommand : ICommand {
|
|||
|
||||
var reminderText = cmd.GetRemaining(cleanArgs, 1, "ReminderText");
|
||||
if (reminderText is not null) {
|
||||
var reminderOffset = DateTimeOffset.Now.Add(remindIn);
|
||||
var reminderOffset = DateTimeOffset.UtcNow.Add(remindIn);
|
||||
GuildData.Get(cmd.Context.Guild).MemberData[cmd.Context.User.Id].Reminders.Add(
|
||||
new Reminder {
|
||||
RemindAt = reminderOffset,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue