MCPcopy Create free account
hub / github.com/codebymitch/TitanBot / execute

Function execute

src/commands/Tools/embedbuilder.js:1057–1172  ·  view source on GitHub ↗
(interaction)

Source from the content-addressed store, hash-verified

1055 .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
1056
1057 async execute(interaction) {
1058 try {
1059 const deferSuccess = await InteractionHelper.safeDefer(interaction, {
1060 flags: MessageFlags.Ephemeral,
1061 });
1062 if (!deferSuccess) return;
1063
1064 const guild = interaction.guild;
1065
1066 const state = {
1067 title: null,
1068 description: null,
1069 color: getColor('primary'),
1070 author: null,
1071 footer: null,
1072 thumbnail: null,
1073 image: null,
1074 timestamp: false,
1075 fields: [],
1076 };
1077
1078 await refreshDashboard(interaction, state);
1079
1080 const collector = interaction.channel.createMessageComponentCollector({
1081 componentType: ComponentType.StringSelect,
1082 filter: i =>
1083 i.user.id === interaction.user.id && i.customId === 'eb_menu',
1084 time: IDLE_TIMEOUT,
1085 });
1086
1087 collector.on('collect', async ci => {
1088 try {
1089 switch (ci.values[0]) {
1090 case 'edit_content':
1091 await handleEditContent(ci, interaction, state);
1092 break;
1093 case 'set_color':
1094 await handleSetColor(ci, interaction, state);
1095 break;
1096 case 'set_author':
1097 await handleSetAuthor(ci, interaction, state);
1098 break;
1099 case 'set_footer':
1100 await handleSetFooter(ci, interaction, state);
1101 break;
1102 case 'set_images':
1103 await handleSetImages(ci, interaction, state);
1104 break;
1105 case 'add_field':
1106 await handleAddField(ci, interaction, state);
1107 break;
1108 case 'edit_field':
1109 await handleEditField(ci, interaction, state);
1110 break;
1111 case 'remove_field':
1112 await handleRemoveField(ci, interaction, state);
1113 break;
1114 case 'reorder_fields':

Callers

nothing calls this directly

Calls 15

getColorFunction · 0.90
replyUserErrorFunction · 0.90
handleEditContentFunction · 0.85
handleSetColorFunction · 0.85
handleSetAuthorFunction · 0.85
handleSetFooterFunction · 0.85
handleSetImagesFunction · 0.85
handleAddFieldFunction · 0.85
handleEditFieldFunction · 0.85
handleRemoveFieldFunction · 0.85
handleReorderFieldsFunction · 0.85
handlePostEmbedFunction · 0.85

Tested by

no test coverage detected