UNPKG

@hunteroi/discord-server-generator

Version:

A framework to generate Discord guild categories, channels and roles, built with DiscordJS

144 lines (143 loc) 5.38 kB
/// <reference types="node" resolution-mode="require"/> import EventEmitter from "node:events"; import { type Client, type GuildResolvable } from "discord.js"; import type { GuildOptions, ServerGeneratorOptions } from "./types/index.js"; /** * * @export * @class ServerGeneratorManager * @extends {EventEmitter} */ export declare class ServerGeneratorManager extends EventEmitter { #private; private client; options: ServerGeneratorOptions; private hasOptionalIntent; constructor(client: Client, options?: ServerGeneratorOptions); /** * Generates a guild from scratch with the given options. * * @param {GuildResolvable} guild * @param {GuildOptions} options * @param {string?} [reason] * @memberof ServerGeneratorManager */ generate(guild: GuildResolvable, options: GuildOptions, reason?: string): Promise<void>; } /** * Emitted when a guild is being generated by the manager. * @event ServerGeneratorManager#guildGenerate * @param {Guild} Guild * @param {GuildOptions} options * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.guildGenerate, (guild, options, reason) => { * console.log(`Generating guild ${guild.id} for reason ${reason} with options`, options); * }); */ /** * Emitted when a guild has just been generated by the manager. * @event ServerGeneratorManager#guildGenerated * @param {Guild} Guild * @param {GuildOptions} options * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.guildGenerated, (guild, options, reason) => { * console.log(`Generated guild ${guild.id} for reason ${reason} with options`, options); * }); */ /** * Emitted when an old role is being deleted by the manager when generating the guild. * @event ServerGeneratorManager#roleDelete * @param {Role} role * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.roleDelete, (role, reason) => { * console.log(`Role ${role.id} deleted for reason ${reason}`); * }); */ /** * Emitted when an old channel is being deleted by the manager when generating the guild. * @event ServerGeneratorManager#channelDelete * @param {GuildChannel} channel * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.channelDelete, (channel, reason) => { * console.log(`Channel ${channel.id} deleted for reason ${reason}`); * }); */ /** * Emitted when an old emoji is being deleted by the manager when generating the guild. * @event ServerGeneratorManager#emojiDelete * @param {GuildEmoji} emoji * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.emojiDelete, (emoji, reason) => { * console.log(`Emoji ${emoji.id} deleted for reason ${reason}`); * }); */ /** * Emitted when an old sticker is being deleted by the manager when generating the guild. * @event ServerGeneratorManager#stickerDelete * @param {Sticker} sticker * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.stickerDelete, (sticker, reason) => { * console.log(`Sticker ${sticker.id} deleted for reason ${reason}`); * }); */ /** * Emitted when a new channel is being created by the manager when generating the guild. * @event ServerGeneratorManager#channelCreate * @param { TextChannel | VoiceChannel | CategoryChannel | NewsChannel | StoreChannel | StageChannel} channel * @param {CategoryOptions | GuildChannelOptions} options * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.channelCreate, (channel, options, reason) => { * console.log(`Channel ${channel.id} created for reason ${reason} with options`, options); * }); */ /** * Emitted when a new thread is being created by the manager when generating the guild. * @event ServerGeneratorManager#threadCreate * @param {ThreadChannel} thread * @param {ThreadOptions} options * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.threadCreate, (thread, options, reason) => { * console.log(`Thread ${thread.id} created for reason ${reason} with options`, options); * }); */ /** * Emitted when a new role is being created by the manager when generating the guild. * @event ServerGeneratorManager#roleCreate * @param {Role} role * @param {RoleOptions} options * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.roleCreate, (role, options, reason) => { * console.log(`Role ${role.id} created for reason ${reason} with options`, options); * }); */ /** * Emitted when a new emoji is being created by the manager when generating the guild. * @event ServerGeneratorManager#emojiCreate * @param {GuildEmoji} emoji * @param {EmojiOptions} options * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.emojiCreate, (emoji, options, reason) => { * console.log(`Emoji ${emoji.id} created for reason ${reason} with options`, options); * }); */ /** * Emitted when a new sticker is being created by the manager when generating the guild. * @event ServerGeneratorManager#stickerCreate * @param {Sticker} sticker * @param {StickerOptions} options * @param {string?} reason * @example * manager.on(ServerGeneratorManagerEvents.stickerCreate, (sticker, options, reason) => { * console.log(`Sticker ${sticker.id} created for reason ${reason} with options`, options); * }); */