@jadl/cmd
Version:
A command handler for JADL
15 lines (14 loc) • 605 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Guild = void 0;
const SimpleError_1 = require("../../structures/SimpleError");
const Decorators_1 = require("../../utils/Decorators");
exports.Guild = Decorators_1.Decorators.createParameterDecorator(([required]) => {
return (int, { worker }) => {
if (!int.guild_id && required)
throw new SimpleError_1.SimpleError('Command is only availabe when used in a server');
if (!int.guild_id)
return undefined;
return worker.guilds.get(int.guild_id);
};
});