尝试使用javascript为discord bot嵌入超链接
我想创建一个discord机器人,当有人键入ping时,它会发出一个嵌入的超链接 我目前的代码是: “embed.js” “ping.js” 我试着这样做: 有了这个指南,,尝试使用javascript为discord bot嵌入超链接,javascript,discord,bots,Javascript,Discord,Bots,我想创建一个discord机器人,当有人键入ping时,它会发出一个嵌入的超链接 我目前的代码是: “embed.js” “ping.js” 我试着这样做: 有了这个指南,, 欢迎提供任何帮助或思考,但请将其解释为5岁或橡皮鸭。似乎您有正确的嵌入代码,但您需要使用Discord.Message.channel.send({embed:exampleembd})发送它 此外,我建议您重新生成您的bot令牌,因为它允许任何人控制您的bot。ty和good call on the token。它应
欢迎提供任何帮助或思考,但请将其解释为5岁或橡皮鸭。似乎您有正确的嵌入代码,但您需要使用
Discord.Message.channel.send({embed:exampleembd})发送它代码>
此外,我建议您重新生成您的bot令牌,因为它允许任何人控制您的bot。ty和good call on the token。它应该可以工作,但每次我尝试命令C:\Users\philip von wowern\Desktop\Discord\embed.js:32 Discord.message.channel.send({embed:examplembed});^TypeError:无法在客户端读取未定义的属性“send”。
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = '-';
const fs = require('fs');
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles){
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.once('ready', () => {
console.log('embed is online!');
});
client.on('message', message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command == 'ping'){
Discord.MessageEmbed.channel.send(exampleEmbed)
}
});
client.login('NzQ4ODQ3MzYwMjA5MzIxOTg0.X0jYcw.fZjcPUwrpEQPkQyqQdxprCYVH6g');
const Discord = require('discord.js');
const exampleEmbed = new Discord.MessageEmbed();
exampleEmbed.setTitle('Some title');
exampleEmbed.setURL('https://discord.js.org/');
Discord.Message.channel.send(exampleEmbed);