Added channels, fixed interactions and added guids

This commit is contained in:
ION606
2023-04-04 22:06:12 -04:00
parent 658b45feee
commit 1a048a01db
10 changed files with 240 additions and 119 deletions
+27 -2
View File
@@ -1,9 +1,29 @@
import axios from 'axios';
import author from '../messages/User.js';
import { Channel, message } from '../messages/message.js';
import { message } from '../messages/message.js';
import { Channel } from '../guilds/Channel.js';
import {Embed} from '../messages/embed.js';
import Guild from '../guilds/Guild.js';
class interactionOptions {
/** @type {String} */
name;
/** @type {Number} */
type;
/** @type {[{value: any, type: Number, name: String}]} */
options;
/** @type {Boolean} */
focused;
constructor(o) {
for (const k in this) {
if (o[k]) this[k] = o[k];
}
}
}
export class Interaction {
/** @type {author} */
@@ -36,6 +56,9 @@ export class Interaction {
/** @type {String} */
guild_id;
/** @type {interactionOptions} */
data;
/**
* @param {{content: String, ephemeral?: Boolean, embeds: [Embed]} | String} inp
@@ -173,7 +196,9 @@ export class Interaction {
for (const k in this) {
if (intRaw[k] != undefined) {
if (k == "user") this[k] = new author(intRaw[k]);
else {
else if (k == 'data') {
this.data = new interactionOptions(intRaw[k]);
} else {
if (k == 'channel_id') {
this.channel = new Channel(intRaw[k], this.guild, this.#application.token);
}