29 lines
1.0 KiB
TypeScript
Executable File
29 lines
1.0 KiB
TypeScript
Executable File
import { SlashCommandBuilder, ChatInputCommandInteraction } from 'discord.js'
|
|
|
|
export default {
|
|
data: new SlashCommandBuilder()
|
|
.setName('spam')
|
|
.setDescription('Spam')
|
|
.addUserOption(option => option.setName('user').setDescription('Spam').setRequired(true))
|
|
.addStringOption(option => option.setName('string').setDescription('Spam').setRequired(true))
|
|
.addIntegerOption(option => option.setName('integer').setDescription('Spam').setRequired(true)),
|
|
async execute(interaction: ChatInputCommandInteraction) {
|
|
let user = interaction.options.getUser('user')
|
|
let string = interaction.options.getString('string')
|
|
let integer = interaction.options.getInteger('integer')
|
|
|
|
await interaction.reply({ content: 'Spam', ephemeral: true })
|
|
let i = 0
|
|
function myLoop() {
|
|
setTimeout(function () {
|
|
if (!user) return
|
|
if (!string) return
|
|
if (!integer) return
|
|
user.send(string).catch(error => console.error(error))
|
|
i++
|
|
if (i < integer) myLoop()
|
|
}, 1000)
|
|
}
|
|
myLoop()
|
|
}
|
|
} |