summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/structures/Base.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/Base.js
downloadsowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.gz
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.tar.bz2
sowbot3-e4450c8417624b71d779cb4f41692538f9165e10.zip
first commit
Diffstat (limited to 'node_modules/discord.js/src/structures/Base.js')
-rw-r--r--node_modules/discord.js/src/structures/Base.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/structures/Base.js b/node_modules/discord.js/src/structures/Base.js
new file mode 100644
index 0000000..102fb21
--- /dev/null
+++ b/node_modules/discord.js/src/structures/Base.js
@@ -0,0 +1,43 @@
+'use strict';
+
+const { flatten } = require('../util/Util');
+
+/**
+ * Represents a data model that is identifiable by a Snowflake (i.e. Discord API data models).
+ * @abstract
+ */
+class Base {
+ constructor(client) {
+ /**
+ * The client that instantiated this
+ * @name Base#client
+ * @type {Client}
+ * @readonly
+ */
+ Object.defineProperty(this, 'client', { value: client });
+ }
+
+ _clone() {
+ return Object.assign(Object.create(this), this);
+ }
+
+ _patch(data) {
+ return data;
+ }
+
+ _update(data) {
+ const clone = this._clone();
+ this._patch(data);
+ return clone;
+ }
+
+ toJSON(...props) {
+ return flatten(this, ...props);
+ }
+
+ valueOf() {
+ return this.id;
+ }
+}
+
+module.exports = Base;