Advertisement
thepotsu

Untitled

May 5th, 2024
839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         let ViewingContentType:"Guide"|"Command"|undefined = undefined;
  2.         let ViewingContentIndex:number|undefined = undefined;
  3.  
  4.         const HelpPagination = new Pagination<typeof Contents>()
  5.             .setItems(Contents)
  6.             .setDisplayItemsPerPage(25)
  7.             .setUser(User)
  8.             .setMapItemsFn(function (FilteredContent, Page) {
  9.                 const Embeds = [];
  10.  
  11.                 if ((ViewingContentType !== undefined) && (ViewingContentIndex !== undefined)) {
  12.                     switch (ViewingContentType) {
  13.                         case "Command": {
  14.                             const Command = FilteredCommands[ViewingContentIndex];
  15.                             Embeds.push(...)
  16.                         } break;
  17.  
  18.                         case "Guide": {
  19.                             const Guide = FilteredGuides[ViewingContentIndex];
  20.                             Embeds.push(...)
  21.                         } break;
  22.                     }
  23.                 }
  24.                
  25.                 return {
  26.                     content     : `${User}`,
  27.                     embeds      : [
  28.                         ...Embeds,
  29.  
  30.                         new EmbedBuilder()
  31.                         .setTitle("Results matching query")
  32.                         .setDescription(...)
  33.                         .setColor(...)
  34.                     ],
  35.                     components      : [
  36.                         new ActionRowBuilder<StringSelectMenuBuilder>()
  37.                         .addComponents(...)
  38.                     ]
  39.                 }
  40.             })
  41.             .setCustomFunctions(async function (CustomId, Interaction) {
  42.                 if (...) {
  43.                     ViewingContentIndex = Number((Interaction as StringSelectMenuInteraction).values[0].split(";")[1]);
  44.                     ViewingContentType = (Interaction as StringSelectMenuInteraction).values[0].split(";")[0] as "Guide"|"Command";
  45.                    
  46.                     return { ContinueRunning : true, ReplyWithDefaultContent : true };
  47.                 } else return { UnknownCustomId : true };
  48.             });
  49.        
  50.         await HelpPagination.Start(Origin);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement