@grammyjs/commands
Version:
grammY Commands Plugin
31 lines (30 loc) • 1.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UncompliantCommandsError = exports.CustomPrefixNotSupportedError = exports.InvalidScopeError = void 0;
class InvalidScopeError extends Error {
constructor(scope) {
super(`Invalid scope: ${scope}`);
this.name = "InvalidScopeError";
}
}
exports.InvalidScopeError = InvalidScopeError;
class CustomPrefixNotSupportedError extends Error {
constructor(message, offendingCommands) {
super(message);
this.offendingCommands = offendingCommands;
this.name = "CustomPrefixNotSupportedError";
}
}
exports.CustomPrefixNotSupportedError = CustomPrefixNotSupportedError;
class UncompliantCommandsError extends Error {
constructor(commands) {
const message = [
`Tried to set bot commands with one or more commands that do not comply with the Bot API requirements for command names. Offending command(s):`,
commands.map(({ name, reasons, language }) => `- (language: ${language}) ${name}: ${reasons.join(", ")}`)
.join("\n"),
"If you want to filter these commands out automatically, set `ignoreUncompliantCommands` to `true`",
].join("\n");
super(message);
}
}
exports.UncompliantCommandsError = UncompliantCommandsError;