@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
35 lines (33 loc) • 973 B
JavaScript
import { PreconditionError } from "../errors/PreconditionError.mjs";
import { Piece } from "@sapphire/pieces";
import { Result } from "@sapphire/result";
//#region src/lib/structures/Precondition.ts
var Precondition = class extends Piece {
constructor(context, options = {}) {
super(context, options);
this.position = options.position ?? null;
}
ok() {
return Result.ok();
}
/**
* Constructs a {@link PreconditionError} with the precondition parameter set to `this`.
* @param options The information.
*/
error(options = {}) {
return Result.err(new PreconditionError({
precondition: this,
...options
}));
}
async fetchChannelFromInteraction(interaction) {
return await interaction.client.channels.fetch(interaction.channelId, {
cache: false,
allowUnknownGuild: true
});
}
};
var AllFlowsPrecondition = class extends Precondition {};
//#endregion
export { AllFlowsPrecondition, Precondition };
//# sourceMappingURL=Precondition.mjs.map