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:
parent
0be54912c4
commit
893a77d562
202 changed files with 1037 additions and 1069 deletions
|
@ -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 = {};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue