mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
fix: catch and report errors when applying role button components
This commit is contained in:
parent
22bd0ec422
commit
75bd7625a2
1 changed files with 8 additions and 3 deletions
|
@ -88,7 +88,7 @@ export async function applyRoleButtons(
|
||||||
candidateMessage = await channel.send(configItem.message.content as string | MessageOptions);
|
candidateMessage = await channel.send(configItem.message.content as string | MessageOptions);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
||||||
body: `Error while posting message for role_buttons/${configItem.name}`,
|
body: `Error while posting message for role_buttons/${configItem.name}: ${String(err)}`,
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -99,14 +99,19 @@ export async function applyRoleButtons(
|
||||||
|
|
||||||
if (message.author.id !== pluginData.client.user?.id) {
|
if (message.author.id !== pluginData.client.user?.id) {
|
||||||
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
||||||
body: `Error applying role buttons for role_buttons/${configItem.name}: target message must be posted by the bot`,
|
body: `Error applying role buttons for role_buttons/${configItem.name}: target message must be posted by Zeppelin`,
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply role buttons
|
// Apply role buttons
|
||||||
const components = createButtonComponents(configItem);
|
const components = createButtonComponents(configItem);
|
||||||
await message.edit({ components });
|
await message.edit({ components }).catch((err) => {
|
||||||
|
pluginData.getPlugin(LogsPlugin).logBotAlert({
|
||||||
|
body: `Error applying role buttons for role_buttons/${configItem.name}: ${String(err)}`,
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
channel_id: message.channelId,
|
channel_id: message.channelId,
|
||||||
|
|
Loading…
Add table
Reference in a new issue