3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-22 09:15:03 +00:00

Finish preliminary rework, ready to test

This commit is contained in:
Dark 2021-06-02 04:07:50 +02:00
parent 293a850075
commit c99e745f89
177 changed files with 854 additions and 707 deletions

View file

@ -4,6 +4,7 @@ import { messageLink } from "../../../utils";
import { sendErrorMessage } from "../../../pluginUtils";
import { canReadChannel } from "../../../utils/canReadChannel";
import { TextChannel } from "discord.js";
export const ContextCmd = utilityCmd({
trigger: "context",
@ -35,12 +36,17 @@ export const ContextCmd = utilityCmd({
return;
}
const previousMessage = (await pluginData.client.getMessages(channel.id, 1, messageId))[0];
const previousMessage = (
await (pluginData.guild.channels.cache.get(channel.id) as TextChannel).messages.fetch({
limit: 1,
before: messageId,
})
)[0];
if (!previousMessage) {
sendErrorMessage(pluginData, msg.channel, "Message context not found");
return;
}
msg.channel.createMessage(messageLink(pluginData.guild.id, previousMessage.channel.id, previousMessage.id));
msg.channel.send(messageLink(pluginData.guild.id, previousMessage.channel.id, previousMessage.id));
},
});