(随机字符串,这样我就可以发布此消息,请忽略。)
代码:
const { Client } = require('discord.js-selfbot-v13');
const client = new Client({
checkUpdate: false,
});
client.on('ready', async () => {
const channelId = '1190781950944886870';
const channel = client.channels.cache.get(channelId);
if (channel) {
console.log(`Channel found: ${channel.name}`);
channel.sendSlash('1190781950944886867', 'about');
} else {
console.error('Channel not found.');
}
});
client.login('my token');
错误:
Channel found: general
C:\Users\sir\node_modules\discord.js-selfbot-v13\src\errors\DJSError.js:40
if (!msg) throw new Error(`An invalid error message key was used: ${key}.`);
^
Error: An invalid error message key was used: botId is not a bot or does not have an application slash command.
at message (C:\Users\sir\node_modules\discord.js-selfbot-v13\src\errors\DJSError.js:40:19)
at new DiscordjsError (C:\Users\sir\node_modules\discord.js-selfbot-v13\src\errors\DJSError.js:16:13)
at TextChannel.sendSlash (C:\Users\sir\node_modules\discord.js-selfbot-v13\src\structures\interfaces\TextBasedChannel.js:497:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v20.10.0
我希望我的帐户能够通过 ID
(/about)
触发频道中机器人的斜线命令
1190781950944886870
const { 客户端} = require('discord.js-selfbot-v13'); const client = new Client();
client.on('准备好', async () => { 控制台.log(
${client.user.username} is ready!
);
})
client.on(“messageCreate”,异步(消息)=> {
const channelId = '986457189243838505'; // Replace your channel id here
const channel = client.channels.cache.get(channelId);
if (channel) {
console.log(`Channel found: ${channel.name}`);
channel.sendSlash('235148962103951360', 'about'); // Replace your bot id here
} else {
console.error('Channel not found.');
}
});
client.login('令牌)