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

fix: fix error if the specified role buttons message id doesn't point to a valid message

This commit is contained in:
Dragory 2022-04-23 20:01:21 +03:00
parent 7f34099ce1
commit 0fe37ff09e

View file

@ -32,7 +32,8 @@ export async function applyRoleButtons(
if ("message_id" in configItem.message) {
// channel id + message id: apply role buttons to existing message
const channel = await pluginData.guild.channels.fetch(configItem.message.channel_id);
const messageCandidate = await (channel?.isText() && channel.messages.fetch(configItem.message.message_id));
const messageCandidate = await (channel?.isText() &&
channel.messages.fetch(configItem.message.message_id).catch(() => null));
if (!messageCandidate) {
pluginData.getPlugin(LogsPlugin).logBotAlert({
body: `Message not found for role_buttons/${configItem.name}`,