Added message select menues (mentionable not available)

This commit is contained in:
ION606
2023-04-16 19:50:45 -04:00
parent ed16d4aeca
commit 7996d6af7c
16 changed files with 313 additions and 51 deletions
+37 -4
View File
@@ -1,11 +1,45 @@
import { Modal } from "./Modal.js";
import { Interaction } from "./interaction.js";
import { interactionTypes } from "./interactionTypes.js";
import * as msgMenu from './MessageSelectMenu.js';
/* inp.data
{ values: [ 'llllll' ], custom_id: 'temp', component_type: 3 }
function selectMenuTypes(inp) {
{
values: [ '720349017829015633' ],
resolved: {
users: { '720349017829015633': [Object] },
members: { '720349017829015633': [Object] }
},
custom_id: 'userMenu',
component_type: 5
}
*/
function createSelectMenu(inp, client) {
// console.log(inp.data);//.filter(o => o.type in msgMenu.SelectMenuTypes);
switch (inp.data.component_type) {
case msgMenu.SelectMenuTypes.CHANNELS:
return new msgMenu.ChannelSelectMenu(inp.data, client);
case msgMenu.SelectMenuTypes.MENTIONABLE:
throw "MENTIONABLE MENUS NOT CURRENTLY SUPPORTED";
case msgMenu.SelectMenuTypes.ROLE:
return new msgMenu.RoleSelectMenu(inp.data, client);
case msgMenu.SelectMenuTypes.TEXT:
return new msgMenu.StringSelectMenu(inp.data, client);
case msgMenu.SelectMenuTypes.USER:
return new msgMenu.userSelectMenu(inp.data);
default: console.log("DEFAULT", inp.data);
}
}
export function createInteraction(intRaw, client) {
switch (intRaw.type) {
@@ -13,8 +47,7 @@ export function createInteraction(intRaw, client) {
return new Interaction(intRaw, client);
case interactionTypes.MessageComponent:
console.log(intRaw.message.components);
return null;
return createSelectMenu(intRaw, client);
case interactionTypes.ModalSubmit:
return new Modal(intRaw, client);