3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-14 21:31:50 +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 8db8b21995
commit a627c7d859
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

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}`,