3.6 KiB
3.6 KiB
Slash command
TextBasedChannel.sendSlash(
user: BotId (Snowflake) | User (User.bot === true),
commandName: 'command_name [sub_group] [sub]',
...args: (string|number|boolean|FileLike|undefined)[],
): Promise<Message<true> | Modal>
Basic
Demo
Code
await channel.sendSlash('bot_id', 'aiko')
Sub Command / Sub Group
Demo
Code test
await channel.sendSlash('450323683840491530', 'animal chat', 'bye')
Attachment
Demo
Code test
const { MessageAttachment } = require('discord.js-selfbot-v13')
const fs = require('fs')
const a = new MessageAttachment(fs.readFileSync('./wallpaper.jpg') , 'test.jpg')
await message.channel.sendSlash('718642000898818048', 'sauce', a)
Result
Skip options
Demo Command
Code
const channel = client.channels.cache.get('channel_id');
const response = await channel.sendSlash(
'bot_id',
'image make',
'MeinaMix - v11',
'Phone (9:16) [576x1024 | 810x1440]',
'2', // String choices, not number
undefined, // VAE
undefined, // sdxl_refiner
undefined, // sampling_method,
30,
);
// Submit Modal
if (!response.isMessage) { // Modal
response.components[0].components[0].setValue(
'1girl, brown hair, green eyes, colorful, autumn, cumulonimbus clouds',
);
response.components[1].components[0].setValue(
'(worst quality:1.4), (low quality:1.4), (normal quality:1.4), (ugly:1.4), (bad anatomy:1.4), (extra limbs:1.2), (text, error, signature, watermark:1.2), (bad legs, incomplete legs), (bad feet), (bad arms), (bad hands, too many hands, mutated hands), (zombie, sketch, interlocked fingers, comic, morbid), cropped, long neck, lowres, missing fingers, missing arms, missing legs, extra fingers, extra digit, fewer digits, jpeg artifacts',
);
await response.reply();
}
Receive messages after bot has replied {botname} is thinking...
const channel = client.channels.cache.get('id');
channel
.sendSlash('289066747443675143', 'osu', 'Accolibed')
.then(async (message) => {
if (message.flags.has('LOADING')) { // owo is thinking...
return new Promise((r, rej) => {
let t = setTimeout(() => rej('timeout'), 15 * 60 * 1000); // 15m (DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE)
message.client.on('messageUpdate', (_, m) => {
if (_.id == message.id) {
clearTimeout(t);
r(m);
}
});
});
} else {
return Promise.resolve(message);
}
})
.then(console.log);