UNPKG

discordjs-automod

Version:

A package to easily add some extra auto-moderation protection to bots

27 lines (22 loc) 870 B
const Discord = require("discord.js"); const Guild = require("../structs/Guild"); const EventEmitter = require("events"); class Client extends EventEmitter { /** * @param {Discord.Client} client The Discord client */ constructor(client) { if (!client instanceof Discord.Client) throw new TypeError("Parameter `client` is not an instance of a Discord Client") this._client = client; } /** * Get a guild object * @param {Discord.Snowflake} guild The ID of the guild to get * @returns {Discord.Guild} A guild object */ getGuild(guild) { if (!this._client.guilds.cache.get(guild) instanceof Discord.Guild) throw new Error("Parameter `guild` is not a guild snowflake"); return new Guild(this, this._client.guilds.resolve(guild)); } } module.exports = Client;