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

Fixes, refactoring and PR feedback

This commit is contained in:
Lily Bergonzat 2024-04-15 15:51:45 +02:00
parent 0be54912c4
commit 893a77d562
202 changed files with 1037 additions and 1069 deletions

View file

@ -5,7 +5,7 @@ import { validateNoObjectAliases } from "./validateNoObjectAliases";
* Loads a YAML file safely while removing object anchors/aliases (including arrays)
*/
export function loadYamlSafely(yamlStr: string): any {
let loaded = yaml.safeLoad(yamlStr);
let loaded = yaml.load(yamlStr);
if (loaded == null || typeof loaded !== "object") {
loaded = {};
}

View file

@ -34,13 +34,11 @@ export async function waitForButtonConfirm(
.setCustomId(`cancelButton:${idMod}:${uuidv4()}`),
]);
const sendMethod = () => {
return contextIsInteraction
? context.replied
? context.editReply.bind(context)
: context.reply.bind(context)
: "send" in context
? context.send.bind(context)
: context.channel.send.bind(context.channel);
if (contextIsInteraction) {
return context.replied ? context.editReply.bind(context) : context.reply.bind(context);
} else {
return "send" in context ? context.send.bind(context) : context.channel.send.bind(context.channel);
}
};
const extraParameters = contextIsInteraction ? { fetchReply: true, ephemeral: true } : {};
const message = (await sendMethod()({ ...toPost, components: [row], ...extraParameters })) as Message;