所以,當有人說“*Staff”時,我試圖在我的機器人中使用“MessageEmbed”,但是,“MessageEmbed”正在殺死我并且每次我嘗試修復它時都會說錯誤,我希望得到一些幫助:D。謝謝
錯誤:
代碼:
const express = require("express");
const app = express();
const Discord = require('discord.js');
const client = new Discord.Client();
const cmd = require("node-cmd");
const ms = require("ms");
const fs = require('fs');
const ytdl = require("ytdl-core");
const canvas = require("canvas");
const convert = require("hh-mm-ss")
const fetchVideoInfo = require("youtube-info");
const simpleytapi = require('simple-youtube-api')
const util = require("util")
const gif = require("gif-search");
const jimp = require("jimp");
const guild = require('guild');
const hastebins = require('hastebin-gen');
const getYoutubeID = require('get-youtube-id');
const pretty = require("pretty-ms");
const moment = require('moment');
const request = require('request');
const dateFormat = require('dateformat');
app.listen(() => console.log("DwaCraft SayBot Starting...."));
const prefix = "*"//Prefix
const developers = ["612110791683866644","694996503324000378"] //Devs IDs
const dev1 = "612110791683866644"
const owner = "694996503324000378"
const dev3 = " "
const dev4 = " "
///help
client.on("message", message => {
if (message.content.toLowerCase() === prefix "help") {
message.delete(5000)
if(!message.channel.guild) return;
const e = new Discord.RichEmbed()
.setColor('#36393e')
.setTitle('sent in DM')
const embed = new Discord.RichEmbed()
.setColor('#36393e')
.setDescription(`
\`\`\`Main Commands :\`\`\`
- ${prefix}ping : To know the connection speed of the bot
\`\`\`Admin Commands :\`\`\`
- ${prefix}say : make the bot say any thing
`)
message.channel.send(e).then(m => m.delete(5000))
message.author.sendEmbed(embed).catch(error => message.reply('**open your dm to allow me to send it**'))
}
});
//say embad
client.on("message", message => {
if (message.author.bot) return;
if (!message.content.startsWith(prefix)) return;
let command = message.content.split(" ")[0];
command = command.slice(prefix.length);
let args = message.content.split(" ").slice(1);
if (command === "say") {
if (!message.channel.guild)
return message.channel
.send("This is only for servers")
.then(m => m.delete(5000));
if (!message.member.hasPermission("ADMINISTRATOR"))
return message.channel.send("Unfortunately, you don't have the permission ADMINISTRATOR");
message.delete();
message.channel.sendMessage(args.join(" "));
if (message == prefix "say")
message.channel.sendMessage("Please contain a message")
.then(m => m.delete(3000));
}
if (command == "embed") {
if (!message.channel.guild)
return message.channel
.send("This command is only for servers")
.then(m => m.delete(5000));
if (!message.member.hasPermission("MANAGE_MESSAGES"))
return message.channel.send("You don't have the permission to use this command.");
let say = new Discord.RichEmbed()
.setDescription(args.join(" "))
.setColor(694996);
message.channel.sendEmbed(say);
message.delete();
if (message == prefix "embed")
message.channel.sendMessage("Please contain a message")
.then(m => m.delete(3000));
}
});
client.on("ready", () =>{
console.log(`Logged in as ${client.user.tag}!`);
client.user.setPresence({
status: "online", // Do not disturb is dnd
game: {
name: "DwaCraft.net", // msg
type: "PLAYING" // PLAYING, WATCHING LISTENING, STREAMING,
}
});
});
client.on("message", message => {
if (message.content.startsWith(prefix "setname")) {
let args = message.content.split(" ");
let botnameee = args.slice(1).join(" ");
if (!developers.includes(message.author.id))
return message.channel.send(
`** :x: Only Developers/Owners Can Use this Command ! :x: **`
);
if (!botnameee)
return message.channel.send(
`** :x: Please Provide the new name ! :x: **`
);
message.channel.send(`Changing to the new Name...`).then(me => {
setTimeout(function(){
me.edit(`Changing to the new Name.`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Changing to the new Name..`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Changing to the new Name...`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Please wait.`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Please wait..`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Please wait...`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Done, Changed my name to *${botnameee}*!`);
client.user.setUsername(`${botnameee}`);
}, 12000); //milliseconds, 100ms = 1s
});
}
if (message.content.startsWith(prefix "setavatar")) {
let args = message.content.split(" ");
let botnameee = args.slice(1).join(" ");
if (!developers.includes(message.author.id))
return message.channel.send(
`** :x: Only Developers/Owners Can Use this Command ! :x: **`
);
if (!botnameee)
return message.channel.send(
`** :x: Please Provide an avatar ! :x: **`
);
message.channel.send(`Changing The bot's Avatar...`).then(me => {
setTimeout(function(){
me.edit(`Changing to the new Avatar.`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Changing to the new Avatar..`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Changing to the new Avatar...`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Please wait.`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Please wait..`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Please wait...`);
}, 2000); //milliseconds, 100ms = 1s
setTimeout(function(){
me.edit(`Done, Changed Avatar to *${botnameee}*!`);
client.user.setAvatar(`${botnameee}`);
}, 12000); //milliseconds, 100ms = 1s
});
}
});
client.on("message", message => {
if (message.content.startsWith(prefix "staff")) {
const devs = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Staff')
.setURL('https://dwacraft.tebex.io')
.setAuthor('DwaCraft', 'https://imgur.com/a/nbIWI5n', 'https://dwacraft.tebex.io')
.setDescription("\u200B")
.setThumbnail('https://imgur.com/a/nbIWI5n')
.addFields(
{ name: '\u200B', value: '\u200B', inline: true },
{ name: '\u200B', value: '*STAFF*', inline: true },
{ name: '\u200B', value: '\u200B', inline: true },
{ name: '\u200B', value: '\u200B' },
{ name: 'Owner', value: 'SirDevinci', inline: true },
{ name: 'Manager', value: 'GrowTaz', inline: true },
{ name: 'Developer', value: 'Hamoodiyt', inline: true },
{ name: 'Developer', value: 'Enkix', inline: true },
)
.setTimestamp()
.setFooter('DwaCraft on top', 'https://imgur.com/a/nbIWI5n');
message.channel.send(devs);
}
});
client.login("TOKEN");
^^^ 順便說一句,我不確定上面的錯誤是否有效......
Package.json 檔案
{
"main": "index.js",
"dependencies": {
"array-sort": "^1.0.0",
"canvas": "^2.6.1",
"dateformat": "^3.0.3",
"discord.js": "^11.3.2",
"express": "^4.17.1",
"get-youtube-id": "^1.0.1",
"gif-search": "^2.1.0",
"guild": "^1.2.2",
"hastebin-gen": "^2.0.5",
"hh-mm-ss": "^1.2.0",
"jimp": "^0.14.0",
"moment": "^2.27.0",
"ms": "^2.1.2",
"node-cmd": "^3.0.0",
"pretty-ms": "^7.0.0",
"request": "^2.88.2",
"simple-youtube-api": "^5.2.1",
"table": "^5.4.6",
"util": "^0.12.3",
"youtube-info": "^1.3.2",
"ytdl-core": "^3.1.2"
}
}
在此處輸入圖片說明
注意:如果可以,請和我談談 Discord [Hamoodiyt#4822]
uj5u.com熱心網友回復:
您使用的是 discord.js v11,所以您不能使用MessageEmbed()并且必須使用RichEmbed()!
uj5u.com熱心網友回復:
這是我更改 message.channel.send(devs) 后的新錯誤;到 message.channel.send({embeds [devs]}) !

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/357672.html
標籤:javascript 不和谐.js

