Added base modals and 'finished' menus

This commit is contained in:
ION606
2023-04-14 16:52:56 -04:00
parent 410473ecf8
commit ed16d4aeca
8 changed files with 67 additions and 12 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import gateWayEvents from '../gateway/dispatch.js'
import { message } from '../messages/message.js';
import {Interaction} from '../interactions/interaction.js';
import Guild from '../guilds/Guild.js';
import { createInteraction } from '../interactions/createInteraction.js';
/**
@@ -28,7 +28,7 @@ export default async function handleEvents(msgObj, token, client) {
break;
case gateWayEvents.InteractionCreate:
resolve({op: op, t: t, interaction: new Interaction(msgObj["d"], client)});
resolve({op: op, t: t, interaction: createInteraction(msgObj["d"], client)}); //interaction: new Interaction(msgObj["d"], client)
break;
case gateWayEvents.GuildCreate:
+9
View File
@@ -0,0 +1,9 @@
import { Interaction } from "./interaction.js";
export class Modal extends Interaction {
constructor(intRaw, client) {
super(intRaw, client);
console.log(intRaw);
}
}
@@ -0,0 +1,28 @@
import { Modal } from "./Modal.js";
import { Interaction } from "./interaction.js";
import { interactionTypes } from "./interactionTypes.js";
function selectMenuTypes(inp) {
}
export function createInteraction(intRaw, client) {
switch (intRaw.type) {
case interactionTypes.ApplicationCommand:
return new Interaction(intRaw, client);
case interactionTypes.MessageComponent:
console.log(intRaw.message.components);
return null;
case interactionTypes.ModalSubmit:
return new Modal(intRaw, client);
case interactionTypes.Ping:
console.log("pong");
return null;
default: console.log(`UNKNOWN INTERACTION:\n`, intRaw);
}
}
+1
View File
@@ -21,6 +21,7 @@ class interactionOptions {
focused;
constructor(o) {
console.log(o);
for (const k in this) {
if (o[k]) this[k] = o[k];
}
@@ -0,0 +1,8 @@
export const interactionTypes = Object.freeze({
Ping: 1,
ApplicationCommand: 2,
MessageComponent: 3,
ApplicationCommandAutocomplete: 4,
ModalSubmit: 5
});