Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions commands/owner/csClassPoll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export default {
let classes: Class[] = await classModel.find({}).sort({ CODE: 1 });
const class_chunks = split_list(classes, 25);

class_chunks.forEach((class_chunk, index) => {
for(let index = 0; index < class_chunks.length; index ++){
const menu = new MessageSelectMenu();
menu.setCustomId(`csClassPoll+${index}`);
// menu.setMinValues(1); //!Add this later when the bot is able to handle multiple selections at once
// menu.setMaxValues(10);
menu.setPlaceholder("Select an option");
// create a new list of options from the classes and add to menu
menu.addOptions(class_chunk.map(create_option_from_class));
menu.addOptions(class_chunks[index].map(create_option_from_class));

// Add single message to action row
const row = new MessageActionRow();
Expand All @@ -64,7 +64,9 @@ export default {
} else {
msgInt.channel!.send({ components: [row] });
}
});
// await on a new promise that resolves itself after a delay of 200 ms
await new Promise(resolve => {setTimeout(resolve, 200)})
};

// Log the command usage
console.log(
Expand Down
2 changes: 1 addition & 1 deletion features/interactionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default (client: Client): void => {

// Assign the new role to the user
addNewRole(member, "staff", interaction.values[0]);
} else if (interaction.customId === "csClassPoll+0" || interaction.customId === "csClassPoll+1") {
} else if (interaction.customId.startsWith("csClassPoll+")) {
// Set the embed title
const title = "CS Class Poll";
// Create and send the embed object
Expand Down