This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
/
user.js
72 lines (67 loc) · 2.12 KB
/
user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
const DiscordJs = require("discord.js");
// # #
// # #
// # # ### ### # ##
// # # # # # ## #
// # # ### ##### #
// # # # # #
// ### #### ### #
/**
* A class representing a Discord or Tmi user.
*/
class User {
// # #
// # #
// ## ## ### ### ### ### # # ## ### ## ###
// # # # # # ## # # # # # # # # # # #
// # # # # # ## # # # # # # # # #
// ## ## # # ### ## # ### ## ## ## #
/**
* Creates a new user.
* @param {string|DiscordJs.GuildMember} user The user.
*/
constructor(user) {
this.user = user;
}
// # # #
// # #
// ### ## ### ## ## ### ###
// # # # ## # # # # # # #
// # # # ## # # # # # #
// ### ### ### ## ## # ###
/**
* Returns the Discord user.
* @returns {DiscordJs.GuildMember} The Discord user.
*/
get discord() {
return this.user instanceof DiscordJs.GuildMember ? this.user : void 0;
}
// # #
// #
// ### # # ##
// # #### #
// # # # #
// ## # # ###
/**
* Returns the Tmi user.
* @returns {string} The Tmi user.
*/
get tmi() {
return typeof this.user === "string" ? this.user : void 0;
}
// # ## # #
// # # # #
// ### ## # ### ### ## ### ###
// # # # # # # # # # # # #
// # # # # # # # # # # ##
// ## ## ## ## # ### # # #
// ###
/**
* Returns a string representation of the user.
* @returns {string} Returns the user name.
*/
toString() {
return `${this.user}`;
}
}
module.exports = User;