3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-06-08 00:05:01 +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 { registerExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { MINUTES, SECONDS } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { locateUserCmd } from "../types";
export const FollowCmd = locateUserCmd({
@ -27,7 +27,9 @@ export const FollowCmd = locateUserCmd({
const active = args.active || false;
if (time < 30 * SECONDS) {
sendErrorMessage(pluginData, msg.channel, "Sorry, but the minimum duration for an alert is 30 seconds!");
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(msg, "Sorry, but the minimum duration for an alert is 30 seconds!");
return;
}
@ -46,19 +48,23 @@ export const FollowCmd = locateUserCmd({
}
if (active) {
sendSuccessMessage(
pluginData,
msg.channel,
`Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration(
time,
)} i will notify and move you.\nPlease make sure to be in a voice channel, otherwise i cannot move you!`,
);
pluginData
.getPlugin(CommonPlugin)
.sendSuccessMessage(
msg,
`Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration(
time,
)} i will notify and move you.\nPlease make sure to be in a voice channel, otherwise i cannot move you!`,
);
} else {
sendSuccessMessage(
pluginData,
msg.channel,
`Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration(time)} i will notify you`,
);
pluginData
.getPlugin(CommonPlugin)
.sendSuccessMessage(
msg,
`Every time <@${args.member.id}> joins or switches VC in the next ${humanizeDuration(
time,
)} i will notify you`,
);
}
},
});

View file

@ -1,7 +1,7 @@
import { commandTypeHelpers as ct } from "../../../commandTypes";
import { clearExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { createChunkedMessage, sorter } from "../../../utils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { locateUserCmd } from "../types";
export const ListFollowCmd = locateUserCmd({
@ -13,7 +13,7 @@ export const ListFollowCmd = locateUserCmd({
async run({ message: msg, pluginData }) {
const alerts = await pluginData.state.alerts.getAlertsByRequestorId(msg.member.id);
if (alerts.length === 0) {
sendErrorMessage(pluginData, msg.channel, "You have no active alerts!");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "You have no active alerts!");
return;
}
@ -46,7 +46,7 @@ export const DeleteFollowCmd = locateUserCmd({
alerts.sort(sorter("expires_at"));
if (args.num > alerts.length || args.num <= 0) {
sendErrorMessage(pluginData, msg.channel, "Unknown alert!");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(msg, "Unknown alert!");
return;
}
@ -54,6 +54,6 @@ export const DeleteFollowCmd = locateUserCmd({
clearExpiringVCAlert(toDelete);
await pluginData.state.alerts.delete(toDelete.id);
sendSuccessMessage(pluginData, msg.channel, "Alert deleted");
pluginData.getPlugin(CommonPlugin).sendSuccessMessage(msg, "Alert deleted");
},
});

View file

@ -1,6 +1,6 @@
import { GuildMember, GuildTextBasedChannel, Snowflake } from "discord.js";
import { GuildPluginData } from "knub";
import { sendErrorMessage } from "../../../pluginUtils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { LocateUserPluginType } from "../types";
export async function moveMember(
@ -16,10 +16,14 @@ export async function moveMember(
channel: target.voice.channelId,
});
} catch {
sendErrorMessage(pluginData, errorChannel, "Failed to move you. Are you in a voice channel?");
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(errorChannel, "Failed to move you. Are you in a voice channel?");
return;
}
} else {
sendErrorMessage(pluginData, errorChannel, "Failed to move you. Are you in a voice channel?");
pluginData
.getPlugin(CommonPlugin)
.sendErrorMessage(errorChannel, "Failed to move you. Are you in a voice channel?");
}
}

View file

@ -1,7 +1,7 @@
import { GuildMember, GuildTextBasedChannel, Invite, VoiceChannel } from "discord.js";
import { GuildPluginData } from "knub";
import { getInviteLink } from "knub/helpers";
import { sendErrorMessage } from "../../../pluginUtils";
import { CommonPlugin } from "../../Common/CommonPlugin";
import { LocateUserPluginType } from "../types";
import { createOrReuseInvite } from "./createOrReuseInvite";
@ -22,7 +22,7 @@ export async function sendWhere(
try {
invite = await createOrReuseInvite(voice);
} catch {
sendErrorMessage(pluginData, channel, "Cannot create an invite to that channel!");
pluginData.getPlugin(CommonPlugin).sendErrorMessage(channel, "Cannot create an invite to that channel!");
return;
}
channel.send({