Add multiple message sending

This commit is contained in:
Christopher Cookman 2023-05-24 20:35:14 -06:00
parent e106b94cd0
commit 9c9aa113e4
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
2 changed files with 31 additions and 13 deletions

View file

@ -3,6 +3,14 @@
"name": "send", "name": "send",
"description": "Send a message with it's ID for the config file!", "description": "Send a message with it's ID for the config file!",
"type": 1, "type": 1,
"default_member_permissions": 0 "default_member_permissions": 0,
"options": [
{
"name": "count",
"description": "Number of messages to send",
"type": 4,
"required": true
}
]
} }
] ]

View file

@ -331,21 +331,31 @@ client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return; if (!interaction.isCommand()) return;
switch (interaction.commandName) { switch (interaction.commandName) {
case "send": // Send a message with it's message ID case "send": // Send a message with it's message ID
interaction.channel.send({ // check if integer 'count' exists, if not, set it to 1
embeds: [{ if (!interaction.options.getInteger('count')) {
description: "Please Wait" count = 1;
}] } else {
}).then(async (msg) => { count = interaction.options.getInteger('count');
await msg.edit({ }
// Send a message `count` fimes
for (i = 0; i < count; i++) {
interaction.channel.send({
embeds: [{ embeds: [{
description: `ID: ${msg.id}` description: "Please Wait"
}] }]
}).then(async (msg) => {
await msg.edit({
embeds: [{
description: `ID: ${msg.id}`
}]
});
interaction.reply({
"ephemeral": true,
content: "Done!"
})
}); });
interaction.reply({ }
"ephemeral": true,
content: "Done!"
})
});
break; break;
} }
}); });