3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-13 21:35:02 +00:00

Added Discord attachment link reaction, fixed emoji configuration and moved util functions

This commit is contained in:
Lily Bergonzat 2024-02-16 11:51:58 +01:00
parent a4c4b17a14
commit 592d037148
173 changed files with 1540 additions and 1170 deletions

View file

@ -2,8 +2,8 @@ import humanizeDuration from "humanize-duration";
import moment from "moment-timezone";
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { registerUpcomingReminder } from "../../../data/loops/upcomingRemindersLoop";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { convertDelayStringToMS, messageLink } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { remindersCmd } from "../types";
@ -38,7 +38,7 @@ export const RemindCmd = remindersCmd({
// "Delay string" i.e. e.g. "2h30m"
const ms = convertDelayStringToMS(args.time);
if (ms === null) {
sendErrorMessage(pluginData, msg.channel, "Invalid reminder time");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Invalid reminder time");
return;
}
@ -46,7 +46,7 @@ export const RemindCmd = remindersCmd({
}
if (!reminderTime.isValid() || reminderTime.isBefore(now)) {
sendErrorMessage(pluginData, msg.channel, "Invalid reminder time");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Invalid reminder time");
return;
}
@ -67,10 +67,8 @@ export const RemindCmd = remindersCmd({
pluginData.getPlugin(TimeAndDatePlugin).getDateFormat("pretty_datetime"),
);
sendSuccessMessage(
pluginData,
msg.channel,
`I will remind you in **${timeUntilReminder}** at **${prettyReminderTime}**`,
);
pluginData
.getPlugin(CommonPlugin)
.sendSuccessMessage(msg, `I will remind you in **${timeUntilReminder}** at **${prettyReminderTime}**`);
},
});

View file

@ -1,7 +1,7 @@
import humanizeDuration from "humanize-duration";
import moment from "moment-timezone";
import { sendErrorMessage } from "../../../pluginUtils";
import { createChunkedMessage, DBDateFormat, sorter } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin";
import { remindersCmd } from "../types";
@ -12,7 +12,7 @@ export const RemindersCmd = remindersCmd({
async run({ message: msg, pluginData }) {
const reminders = await pluginData.state.reminders.getRemindersByUserId(msg.author.id);
if (reminders.length === 0) {
sendErrorMessage(pluginData, msg.channel, "No reminders");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "No reminders");
return;
}

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { clearUpcomingReminder } from "../../../data/loops/upcomingRemindersLoop";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { sorter } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { remindersCmd } from "../types";
export const RemindersDeleteCmd = remindersCmd({
@ -17,7 +17,7 @@ export const RemindersDeleteCmd = remindersCmd({
reminders.sort(sorter("remind_at"));
if (args.num > reminders.length || args.num <= 0) {
sendErrorMessage(pluginData, msg.channel, "Unknown reminder");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Unknown reminder");
return;
}
@ -25,6 +25,6 @@ export const RemindersDeleteCmd = remindersCmd({
clearUpcomingReminder(toDelete);
await pluginData.state.reminders.delete(toDelete.id);
sendSuccessMessage(pluginData, msg.channel, "Reminder deleted");
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, "Reminder deleted");
},
});