Réécriture complète 4.0
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 6m16s
This commit is contained in:
@@ -1,29 +1,47 @@
|
||||
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()
|
||||
}
|
||||
}
|
||||
import { SlashCommandBuilder, MessageFlags } from "discord.js"
|
||||
import type { ChatInputCommandInteraction } from "discord.js"
|
||||
import { t } from "@/utils/i18n"
|
||||
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName("spam")
|
||||
.setDescription("Spam a user with a message")
|
||||
.setDescriptionLocalizations({ fr: "Spammer un utilisateur avec un message" })
|
||||
.addUserOption(option => option
|
||||
.setName("user")
|
||||
.setDescription("Target user")
|
||||
.setNameLocalizations({ fr: "utilisateur" })
|
||||
.setDescriptionLocalizations({ fr: "Utilisateur cible" })
|
||||
.setRequired(true)
|
||||
)
|
||||
.addStringOption(option => option
|
||||
.setName("message")
|
||||
.setDescription("Message to spam")
|
||||
.setDescriptionLocalizations({ fr: "Message à spammer" })
|
||||
.setRequired(true)
|
||||
)
|
||||
.addIntegerOption(option => option
|
||||
.setName("count")
|
||||
.setDescription("Number of times to spam")
|
||||
.setNameLocalizations({ fr: "nombre" })
|
||||
.setDescriptionLocalizations({ fr: "Nombre de fois à spammer" })
|
||||
.setRequired(true)
|
||||
.setMinValue(1)
|
||||
.setMaxValue(100)
|
||||
)
|
||||
|
||||
export async function execute(interaction: ChatInputCommandInteraction) {
|
||||
const user = interaction.options.getUser("user", true)
|
||||
const string = interaction.options.getString("message", true)
|
||||
const integer = interaction.options.getInteger("count", true)
|
||||
|
||||
await interaction.reply({ content: t(interaction.locale, "salonpostam.spam.started"), flags: MessageFlags.Ephemeral })
|
||||
let i = 0
|
||||
function myLoop() {
|
||||
setTimeout(() => {
|
||||
user.send(string).catch(console.error)
|
||||
i++
|
||||
if (i < integer) myLoop()
|
||||
}, 1000)
|
||||
}
|
||||
myLoop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user