-
Notifications
You must be signed in to change notification settings - Fork 1
/
userInfo.js
47 lines (41 loc) · 1.02 KB
/
userInfo.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
const users = new Map();
export function getUserAll() {
return users;
}
export function getUser(discordName) {
return users.get(discordName);
}
export function getUsernameByKeyPair(key, value) {
var username;
users.forEach((v, name) => {
if (v.has(key)) {
if (v.get(key) == value) {
username = name;
}
}
});
return username;
}
export function getUserValue(discordName, key) {
if (users.has(discordName) && users.get(discordName).has(key)){
return users.get(discordName).get(key);
}
return null;
}
export function addUser(discordName, param1, param2) {
var userMap = new Map();
userMap.set(param1[0], param1[1]);
userMap.set(param2[0], param2[1]);
users.set(discordName, userMap);
}
export function setUser(discordName, key, value) {
var userMap = users.get(discordName);
userMap.set(key, value);
users.set(discordName, userMap);
}
export function removeKeyFromUser(discordName, key) {
var user = users.get(discordName);
if (user.has(key)) {
user.delete(key);
}
}