fixed guild channels and interactions

This commit is contained in:
ION606
2023-04-02 09:49:47 -04:00
parent f1415a9840
commit 658b45feee
10 changed files with 445 additions and 22 deletions
@@ -1,4 +1,4 @@
export default class msgAuthor {
export default class user {
/** @type {String} */
id;
+15 -3
View File
@@ -1,4 +1,4 @@
import author from './author.js';
import author from './User.js';
import axios from 'axios';
@@ -56,7 +56,7 @@ export class Channel {
}
constructor(token, channel, guild) {
constructor(channel, guild, token = null) {
this.#token = token;
for (const k in this) {
if (channel[k]) this[k] = channel[k];
@@ -95,6 +95,17 @@ export class Channel {
resolve(new message(response.data, this.#token));
});
}
toObj() {
var obj = {};
for (const key in this) {
if (key != '#token' && key != 'guild') {
obj[key] = this[key];
}
}
return obj;
}
}
@@ -221,6 +232,7 @@ export class message {
*/
constructor(msgRaw, token, guild) {
this.#token = token;
this.guild = guild;
for (const k in this) {
if (msgRaw[k] != undefined) {
@@ -232,7 +244,7 @@ export class message {
}
else {
if (k == 'channel_id') {
this.channel = new Channel(this.#token, {id: msgRaw[k]}, null);
this.channel = new Channel({id: msgRaw[k]}, this.guild, this.#token);
}
this[k] = msgRaw[k];