3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-17 23:25:02 +00:00

Ugly workaround/hotfix for message fetching

This commit is contained in:
Dragory 2021-08-19 00:49:06 +03:00
parent 499511f79d
commit 8da47e53e6
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
9 changed files with 31 additions and 14 deletions

View file

@ -3,6 +3,7 @@ import { commandTypeHelpers as ct } from "../../../commandTypes";
import { sendErrorMessage, sendSuccessMessage } from "../../../pluginUtils";
import { isDiscordAPIError } from "../../../utils";
import { reactionRolesCmd } from "../types";
import { hotfixMessageFetch } from "../../../utils/hotfixMessageFetch";
export const ClearReactionRolesCmd = reactionRolesCmd({
trigger: "reaction_roles clear",
@ -23,7 +24,7 @@ export const ClearReactionRolesCmd = reactionRolesCmd({
let targetMessage: Message;
try {
targetMessage = await args.message.channel.messages.fetch(args.message.messageId as Snowflake);
targetMessage = await hotfixMessageFetch(args.message.channel, args.message.messageId);
} catch (err) {
if (isDiscordAPIError(err) && err.code === 50001) {
sendErrorMessage(pluginData, msg.channel, "Missing access to the specified message");