gamerbot-module 1.1.2 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/GuildData.d.ts +0 -1
- package/dist/classes/GuildData.js +0 -1
- package/dist/classes/gamerbot.d.ts +1 -1
- package/dist/classes/gamerbot.js +10 -1
- package/package.json +1 -1
- package/dist/classes/config_data.d.ts +0 -17
- package/dist/classes/config_data.js +0 -41
- package/dist/classes/guild_data.d.ts +0 -24
- package/dist/classes/guild_data.js +0 -48
- package/dist/classes/profile_data.d.ts +0 -21
- package/dist/classes/profile_data.js +0 -22
|
@@ -20,7 +20,6 @@ export class GuildData {
|
|
|
20
20
|
this.staffModlogs = json_data.staffModlogs;
|
|
21
21
|
this.sverokMails = json_data.sverokMails;
|
|
22
22
|
this.frameConfig = json_data.frameConfig;
|
|
23
|
-
this.extraObjects = new Map(Object.entries(json_data.extraObjects));
|
|
24
23
|
}
|
|
25
24
|
/**
|
|
26
25
|
* Saves guild data to database
|
package/dist/classes/gamerbot.js
CHANGED
|
@@ -17,7 +17,16 @@ export class GamerBotAPI {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
async getAPIStatus() {
|
|
20
|
-
const response = await fetch(GamerBotAPI.API_URL);
|
|
20
|
+
const response = await fetch(GamerBotAPI.API_URL).catch(() => { });
|
|
21
|
+
if (response == undefined) {
|
|
22
|
+
return await new Promise(r => {
|
|
23
|
+
console.error("API is not available, trying to connect to the API again in 5 seconds");
|
|
24
|
+
setTimeout(() => {
|
|
25
|
+
this.getAPIStatus();
|
|
26
|
+
r(false);
|
|
27
|
+
}, 5000);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
21
30
|
const data = await response.json().catch(() => {
|
|
22
31
|
console.error("API is not available, trying to connect to the API again in 5 seconds");
|
|
23
32
|
setTimeout(() => {
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare class ConfigData {
|
|
2
|
-
id: Number;
|
|
3
|
-
debug: Boolean;
|
|
4
|
-
username: String;
|
|
5
|
-
activity: String;
|
|
6
|
-
activityType: String;
|
|
7
|
-
removeLinks: Boolean;
|
|
8
|
-
xp: Object;
|
|
9
|
-
importantUpdatesChannelId: Object;
|
|
10
|
-
debugGuildID: String;
|
|
11
|
-
json_data: any;
|
|
12
|
-
constructor(json_data: any);
|
|
13
|
-
/**
|
|
14
|
-
* Saves config data to database
|
|
15
|
-
*/
|
|
16
|
-
save(): Promise<unknown>;
|
|
17
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { GamerBotAPI } from "./gamerbot";
|
|
2
|
-
export class ConfigData {
|
|
3
|
-
constructor(json_data) {
|
|
4
|
-
this.json_data = JSON.parse(JSON.stringify(json_data));
|
|
5
|
-
this.id = json_data.id;
|
|
6
|
-
this.debug = json_data.debug;
|
|
7
|
-
this.username = json_data.username;
|
|
8
|
-
this.activity = json_data.activity;
|
|
9
|
-
this.activityType = json_data.activityType;
|
|
10
|
-
this.removeLinks = json_data.removeLinks;
|
|
11
|
-
this.xp = json_data.xp;
|
|
12
|
-
this.importantUpdatesChannelId = json_data.importantUpdatesChannelId;
|
|
13
|
-
this.debugGuildID = json_data.debugGuildID;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Saves config data to database
|
|
17
|
-
*/
|
|
18
|
-
async save() {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
let changed_data = {};
|
|
21
|
-
Object.keys(this).forEach((key) => {
|
|
22
|
-
if (key == "json_data")
|
|
23
|
-
return;
|
|
24
|
-
let value = Object.entries(this).find(([k, v]) => k == key &&
|
|
25
|
-
((!Array.isArray(v)) && !Object.is(v, this.json_data[key]) || (Array.isArray(v) && !GamerBotAPI.arraysEqual(v, this.json_data[key]))));
|
|
26
|
-
if (value)
|
|
27
|
-
changed_data[key] = value[1];
|
|
28
|
-
});
|
|
29
|
-
if (Object.keys(changed_data).length == 0)
|
|
30
|
-
return resolve(changed_data);
|
|
31
|
-
fetch(GamerBotAPI.API_URL + "/api/config/" + this.id, {
|
|
32
|
-
method: "POST",
|
|
33
|
-
body: JSON.stringify(changed_data),
|
|
34
|
-
headers: {
|
|
35
|
-
'Content-Type': 'application/json',
|
|
36
|
-
'authorization': 'Bearer ' + GamerBotAPI.TOKEN
|
|
37
|
-
}
|
|
38
|
-
}).then((response) => { resolve(response); }).catch((err) => { console.error(err); });
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export declare class GuildData {
|
|
2
|
-
guildID: string;
|
|
3
|
-
privateVoiceChannel: string;
|
|
4
|
-
publicVoiceChannel: string;
|
|
5
|
-
infoVoiceChannel: string;
|
|
6
|
-
notificationChannel: string;
|
|
7
|
-
ticketParent: string;
|
|
8
|
-
archivedTicketParent: string;
|
|
9
|
-
allowedLinksChannels: Array<string>;
|
|
10
|
-
trustedLinkRoles: Array<string>;
|
|
11
|
-
noXpChannels: Array<string>;
|
|
12
|
-
whitelistedLinks: Array<object>;
|
|
13
|
-
threedChannels: Array<string>;
|
|
14
|
-
bansTimes: Array<object>;
|
|
15
|
-
topicList: Array<string>;
|
|
16
|
-
staffModlogs: string;
|
|
17
|
-
sverokMails: Array<string>;
|
|
18
|
-
json_data: any;
|
|
19
|
-
constructor(json_data: any);
|
|
20
|
-
/**
|
|
21
|
-
* Saves guild data to database
|
|
22
|
-
*/
|
|
23
|
-
save(): Promise<unknown>;
|
|
24
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { GamerBotAPI } from "./gamerbot";
|
|
2
|
-
export class GuildData {
|
|
3
|
-
constructor(json_data) {
|
|
4
|
-
this.json_data = JSON.parse(JSON.stringify(json_data));
|
|
5
|
-
this.guildID = json_data.guildID;
|
|
6
|
-
this.privateVoiceChannel = json_data.privateVoiceChannel;
|
|
7
|
-
this.publicVoiceChannel = json_data.publicVoiceChannel;
|
|
8
|
-
this.infoVoiceChannel = json_data.infoVoiceChannel;
|
|
9
|
-
this.notificationChannel = json_data.notificationChannel;
|
|
10
|
-
this.ticketParent = json_data.ticketParent;
|
|
11
|
-
this.archivedTicketParent = json_data.archivedTicketParent;
|
|
12
|
-
this.allowedLinksChannels = json_data.allowedLinksChannels;
|
|
13
|
-
this.trustedLinkRoles = json_data.trustedLinkRoles;
|
|
14
|
-
this.noXpChannels = json_data.noXpChannels;
|
|
15
|
-
this.whitelistedLinks = json_data.whitelistedLinks;
|
|
16
|
-
this.threedChannels = json_data.threedChannels;
|
|
17
|
-
this.bansTimes = json_data.bansTimes;
|
|
18
|
-
this.topicList = json_data.topicList;
|
|
19
|
-
this.staffModlogs = json_data.staffModlogs;
|
|
20
|
-
this.sverokMails = json_data.sverokMails;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Saves guild data to database
|
|
24
|
-
*/
|
|
25
|
-
async save() {
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
let changed_data = {};
|
|
28
|
-
Object.keys(this).forEach((key) => {
|
|
29
|
-
if (key == "json_data")
|
|
30
|
-
return;
|
|
31
|
-
let value = Object.entries(this).find(([k, v]) => k == key &&
|
|
32
|
-
((!Array.isArray(v)) && !Object.is(v, this.json_data[key]) || (Array.isArray(v) && !GamerBotAPI.arraysEqual(v, this.json_data[key]))));
|
|
33
|
-
if (value)
|
|
34
|
-
changed_data[key] = value[1];
|
|
35
|
-
});
|
|
36
|
-
if (Object.keys(changed_data).length == 0)
|
|
37
|
-
return resolve(changed_data);
|
|
38
|
-
fetch(GamerBotAPI.API_URL + "/api/guild/" + this.guildID, {
|
|
39
|
-
method: "POST",
|
|
40
|
-
body: JSON.stringify(changed_data),
|
|
41
|
-
headers: {
|
|
42
|
-
'Content-Type': 'application/json',
|
|
43
|
-
'authorization': 'Bearer ' + GamerBotAPI.TOKEN
|
|
44
|
-
}
|
|
45
|
-
}).then((response) => { resolve(response); }).catch((err) => { console.error(err); });
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare class PorfileData {
|
|
2
|
-
userID: String;
|
|
3
|
-
serverID: String;
|
|
4
|
-
xp: Number;
|
|
5
|
-
lastMessageTimestamp: Number;
|
|
6
|
-
xpTimeoutUntil: Number;
|
|
7
|
-
level: Number;
|
|
8
|
-
reminder: Array<String>;
|
|
9
|
-
colorHexCode: String;
|
|
10
|
-
privateVoiceID: String;
|
|
11
|
-
privateVoiceThreadID: String;
|
|
12
|
-
profileFrame: String;
|
|
13
|
-
hasLeftTicket: Boolean;
|
|
14
|
-
xpboost: Object;
|
|
15
|
-
exclusiveFrames: Array<String>;
|
|
16
|
-
modLogs: Array<Object>;
|
|
17
|
-
minecraftWhiteList: Boolean;
|
|
18
|
-
minecraftUsername: String;
|
|
19
|
-
minecraftUuid: String;
|
|
20
|
-
constructor(json_data: any);
|
|
21
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export class PorfileData {
|
|
2
|
-
constructor(json_data) {
|
|
3
|
-
this.userID = json_data.userID;
|
|
4
|
-
this.serverID = json_data.serverID;
|
|
5
|
-
this.xp = json_data.xp;
|
|
6
|
-
this.lastMessageTimestamp = json_data.lastMessageTimestamp;
|
|
7
|
-
this.xpTimeoutUntil = json_data.xpTimeoutUntil;
|
|
8
|
-
this.level = json_data.level;
|
|
9
|
-
this.reminder = json_data.reminder;
|
|
10
|
-
this.colorHexCode = json_data.colorHexCode;
|
|
11
|
-
this.privateVoiceID = json_data.privateVoiceID;
|
|
12
|
-
this.privateVoiceThreadID = json_data.privateVoiceThreadID;
|
|
13
|
-
this.profileFrame = json_data.profileFrame;
|
|
14
|
-
this.hasLeftTicket = json_data.hasLeftTicket;
|
|
15
|
-
this.xpboost = json_data.xpboost;
|
|
16
|
-
this.exclusiveFrames = json_data.exclusiveFrames;
|
|
17
|
-
this.modLogs = json_data.modLogs;
|
|
18
|
-
this.minecraftWhiteList = json_data.minecraftWhiteList;
|
|
19
|
-
this.minecraftUsername = json_data.minecraftUsername;
|
|
20
|
-
this.minecraftUuid = json_data.minecraftUuid;
|
|
21
|
-
}
|
|
22
|
-
}
|