summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/structures/GuildBan.js
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-09-02 19:12:47 -0400
commite4450c8417624b71d779cb4f41692538f9165e10 (patch)
treeb70826542223ecdf8a7a259f61b0a1abb8a217d8 /node_modules/discord.js/src/structures/GuildBan.js
downloadsowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.gz
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.bz2
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.zip
first commit
Diffstat (limited to 'node_modules/discord.js/src/structures/GuildBan.js')
-rw-r--r--node_modules/discord.js/src/structures/GuildBan.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/structures/GuildBan.js b/node_modules/discord.js/src/structures/GuildBan.js
new file mode 100644
index 0000000..9c5a10e
--- /dev/null
+++ b/node_modules/discord.js/src/structures/GuildBan.js
@@ -0,0 +1,59 @@
+'use strict';
+
+const Base = require('./Base');
+
+/**
+ * Represents a ban in a guild on Discord.
+ * @extends {Base}
+ */
+class GuildBan extends Base {
+ constructor(client, data, guild) {
+ super(client);
+
+ /**
+ * The guild in which the ban is
+ * @type {Guild}
+ */
+ this.guild = guild;
+
+ this._patch(data);
+ }
+
+ _patch(data) {
+ if ('user' in data) {
+ /**
+ * The user this ban applies to
+ * @type {User}
+ */
+ this.user = this.client.users._add(data.user, true);
+ }
+
+ if ('reason' in data) {
+ /**
+ * The reason for the ban
+ * @type {?string}
+ */
+ this.reason = data.reason;
+ }
+ }
+
+ /**
+ * Whether this GuildBan is partial. If the reason is not provided the value is null
+ * @type {boolean}
+ * @readonly
+ */
+ get partial() {
+ return !('reason' in this);
+ }
+
+ /**
+ * Fetches this GuildBan.
+ * @param {boolean} [force=true] Whether to skip the cache check and request the API
+ * @returns {Promise<GuildBan>}
+ */
+ fetch(force = true) {
+ return this.guild.bans.fetch({ user: this.user, cache: true, force });
+ }
+}
+
+module.exports = GuildBan;