mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-11 20:55:01 +00:00
Centralize periodic checks for mutes, tempbans, vcalerts, reminders, and scheduled posts
This should result in a significant performance improvement. The new method is also more precise than the old one, allowing the aforementioned checks to be performed with second-precision.
This commit is contained in:
parent
c84d1a0be1
commit
c7751a9da1
55 changed files with 883 additions and 366 deletions
|
@ -5,6 +5,7 @@ import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
|
|||
import { convertDelayStringToMS, messageLink } from "../../../utils";
|
||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
|
||||
import { remindersCmd } from "../types";
|
||||
import { registerUpcomingReminder } from "../../../data/loops/upcomingRemindersLoop";
|
||||
|
||||
export const RemindCmd = remindersCmd({
|
||||
trigger: ["remind", "remindme", "reminder"],
|
||||
|
@ -50,7 +51,7 @@ export const RemindCmd = remindersCmd({
|
|||
}
|
||||
|
||||
const reminderBody = args.reminder || messageLink(pluginData.guild.id, msg.channel.id, msg.id);
|
||||
await pluginData.state.reminders.add(
|
||||
const reminder = await pluginData.state.reminders.add(
|
||||
msg.author.id,
|
||||
msg.channel.id,
|
||||
reminderTime.clone().tz("Etc/UTC").format("YYYY-MM-DD HH:mm:ss"),
|
||||
|
@ -58,6 +59,8 @@ export const RemindCmd = remindersCmd({
|
|||
moment.utc().format("YYYY-MM-DD HH:mm:ss"),
|
||||
);
|
||||
|
||||
registerUpcomingReminder(reminder);
|
||||
|
||||
const msUntilReminder = reminderTime.diff(now);
|
||||
const timeUntilReminder = humanizeDuration(msUntilReminder, { largest: 2, round: true });
|
||||
const prettyReminderTime = (await timeAndDate.inMemberTz(msg.author.id, reminderTime)).format(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue