summaryrefslogtreecommitdiff
path: root/node_modules/discord.js/src/structures/UserProfile.js
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-03 02:37:42 -0700
committer8cy <[email protected]>2020-04-03 02:37:42 -0700
commit60867fb030bae582082340ead7dbc7efdc2f5398 (patch)
tree4c6a7356351be2e4914e15c4703172597c45656e /node_modules/discord.js/src/structures/UserProfile.js
parentcommenting (diff)
downloads5nical-60867fb030bae582082340ead7dbc7efdc2f5398.tar.xz
s5nical-60867fb030bae582082340ead7dbc7efdc2f5398.zip
2020/04/03, 02:34, v1.2.0
Diffstat (limited to 'node_modules/discord.js/src/structures/UserProfile.js')
-rw-r--r--node_modules/discord.js/src/structures/UserProfile.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/node_modules/discord.js/src/structures/UserProfile.js b/node_modules/discord.js/src/structures/UserProfile.js
new file mode 100644
index 0000000..a27d4d0
--- /dev/null
+++ b/node_modules/discord.js/src/structures/UserProfile.js
@@ -0,0 +1,62 @@
+const Collection = require('../util/Collection');
+const UserConnection = require('./UserConnection');
+
+/**
+ * Represents a user's profile on Discord.
+ */
+class UserProfile {
+ constructor(user, data) {
+ /**
+ * The owner of the profile
+ * @type {User}
+ */
+ this.user = user;
+
+ /**
+ * The client that created the instance of the UserProfile
+ * @name UserProfile#client
+ * @type {Client}
+ * @readonly
+ */
+ Object.defineProperty(this, 'client', { value: user.client });
+
+ /**
+ * The guilds that the client user and the user share
+ * @type {Collection<Snowflake, Guild>}
+ */
+ this.mutualGuilds = new Collection();
+
+ /**
+ * The user's connections
+ * @type {Collection<Snowflake, UserConnection>}
+ */
+ this.connections = new Collection();
+
+ this.setup(data);
+ }
+
+ setup(data) {
+ /**
+ * If the user has Discord Premium
+ * @type {boolean}
+ */
+ this.premium = data.premium;
+
+ /**
+ * The date since which the user has had Discord Premium
+ * @type {?Date}
+ */
+ this.premiumSince = data.premium_since ? new Date(data.premium_since) : null;
+
+ for (const guild of data.mutual_guilds) {
+ if (this.client.guilds.has(guild.id)) {
+ this.mutualGuilds.set(guild.id, this.client.guilds.get(guild.id));
+ }
+ }
+ for (const connection of data.connected_accounts) {
+ this.connections.set(connection.id, new UserConnection(this.user, connection));
+ }
+ }
+}
+
+module.exports = UserProfile;