@tryforge/forgescript
Version:
ForgeScript is a comprehensive package that empowers you to effortlessly interact with Discord's API. It ensures scripting remains easy to learn and consistently effective.
45 lines • 1.36 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const structures_1 = require("../../structures");
exports.default = new structures_1.NativeFunction({
name: "$webhookCreate",
version: "1.0.0",
description: "Creates a webhook in a channel, returns the webhook id",
brackets: true,
unwrap: true,
output: structures_1.ArgType.Webhook,
args: [
{
name: "channel ID",
description: "The channel to create the webhook",
type: structures_1.ArgType.Channel,
rest: false,
required: true,
check: (i) => "createWebhook" in i,
},
{
name: "name",
description: "The webhook name",
rest: false,
required: true,
type: structures_1.ArgType.String,
},
{
name: "url",
description: "The avatar url",
rest: false,
type: structures_1.ArgType.String,
},
],
async execute(ctx, [channel, name, url]) {
const ch = channel;
const web = await ch
.createWebhook({
name: name,
avatar: url || undefined,
})
.catch(ctx.noop);
return this.success(web ? web.id : undefined);
},
});
//# sourceMappingURL=webhookCreate.js.map
;