mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
fix: fix error if the specified role buttons message id doesn't point to a valid message
This commit is contained in:
parent
8db8b21995
commit
a627c7d859
1 changed files with 2 additions and 1 deletions
|
@ -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}`,
|
||||
|
|
Loading…
Add table
Reference in a new issue