mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Fix various bugs, update djs
This commit is contained in:
parent
4d1924b1ec
commit
dda19de6e6
31 changed files with 96 additions and 72 deletions
|
@ -38,7 +38,7 @@ export const PostButtonRolesCmd = reactionRolesCmd({
|
|||
const btn = new MessageButton()
|
||||
.setLabel(button.label ?? "")
|
||||
.setStyle(button.style ?? "PRIMARY")
|
||||
.setCustomID(customId)
|
||||
.setCustomId(customId)
|
||||
.setDisabled(button.disabled ?? false);
|
||||
|
||||
if (button.emoji) {
|
||||
|
|
|
@ -14,18 +14,17 @@ import { handleModifyRole, handleOpenMenu } from "../util/buttonActionHandlers";
|
|||
const BUTTON_INVALIDATION_TIME = 15 * MINUTES;
|
||||
|
||||
export const ButtonInteractionEvt = reactionRolesEvt({
|
||||
event: "interaction",
|
||||
event: "interactionCreate",
|
||||
|
||||
async listener(meta) {
|
||||
const int = meta.args.interaction.isMessageComponent()
|
||||
? (meta.args.interaction as MessageComponentInteraction)
|
||||
: null;
|
||||
if (!int) return;
|
||||
const allOnMessage = await meta.pluginData.state.buttonRoles.getAllForMessageId(int.message.id);
|
||||
if (allOnMessage.length === 0) return;
|
||||
|
||||
const cfg = meta.pluginData.config.get();
|
||||
const split = int.customID.split(BUTTON_CONTEXT_SEPARATOR);
|
||||
const context = (await resolveStatefulCustomId(meta.pluginData, int.customID)) ?? {
|
||||
const split = int.customId.split(BUTTON_CONTEXT_SEPARATOR);
|
||||
const context = (await resolveStatefulCustomId(meta.pluginData, int.customId)) ?? {
|
||||
groupName: split[0],
|
||||
action: split[1],
|
||||
roleOrMenu: split[2],
|
||||
|
@ -80,7 +79,7 @@ export const ButtonInteractionEvt = reactionRolesEvt({
|
|||
}
|
||||
|
||||
logger.warn(
|
||||
`Action ${context.action} on button ${int.customID} (Guild: ${int.guildID}, Channel: ${int.channelID}) is unknown!`,
|
||||
`Action ${context.action} on button ${int.customId} (Guild: ${int.guildId}, Channel: ${int.channelId}) is unknown!`,
|
||||
);
|
||||
await sendEphemeralReply(int, `A internal error was encountered, please contact the Administrators!`);
|
||||
},
|
||||
|
|
|
@ -33,7 +33,7 @@ export async function handleOpenMenu(
|
|||
const btn = new MessageButton()
|
||||
.setLabel(menuButton.label ?? "")
|
||||
.setStyle("PRIMARY")
|
||||
.setCustomID(customId)
|
||||
.setCustomId(customId)
|
||||
.setDisabled(menuButton.disabled ?? false);
|
||||
|
||||
if (menuButton.emoji) {
|
||||
|
|
|
@ -38,5 +38,7 @@ export async function resolveStatefulCustomId(pluginData: GuildPluginData<Reacti
|
|||
roleOrMenu: cfgButton.role_or_menu,
|
||||
stateless: false,
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ export function splitButtonsIntoRows(actualButtons: MessageButton[], configButto
|
|||
}
|
||||
}
|
||||
|
||||
if (curRow.components.length >= 1) rows.push(curRow);
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue