mirror of
https://github.com/ION606/custom_discordjs.git
synced 2026-06-06 00:07:01 +00:00
Added message select menues (mentionable not available)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user