I want to update my Truth Or dare bot discord.js v12 to v13. now I faced some problems when I use ping pong its works fine but when I wanna do something with my prefix it gives me this error. I've never used discord.js v13 but one of my friends says that discord.js v12 will be disappear and discord will deactivate those bots
> node .
Truth Or Dare 2.0#2237 Has logged in
(node:107) DeprecationWarning: The message event is deprecated. Use messageCreate instead
(Use `node --trace-deprecation ...` to show where the warning was created)
/home/runner/TOD/node_modules/discord.js/src/rest/RequestHandler.js:349
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (/home/runner/TOD/node_modules/discord.js/src/rest/RequestHandler.js:349:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/runner/TOD/node_modules/discord.js/src/rest/RequestHandler.js:50:14)
at async TextChannel.send (/home/runner/TOD/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:172:15) {
method: 'post',
path: '/channels/874498102139166730/messages',
code: 50006,
httpStatus: 400,
requestData: {
json: {
content: undefined,
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: undefined,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! TOD@1.0.0 start: `node .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the TOD@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-11-24T08_19_36_335Z-debug.log
exit status 1
Now I don't know what is the error for. and it looks so weird to me i don't know why but v13 is like ewww. is anyone can help me, please
here is my Code that i was use in discord v13. i just changed the client line rest all are same
const Discord = require('discord.js');
let client = new Discord.Client({intents: [
"GUILDS",
"GUILD_MESSAGES"
]});
// const disbut = require('discord-buttons');
const prefix = "^";
// ======== Ready Log ========
client.on ("ready", () => {
console.log(`${client.user.tag} Has logged in`)
async function ll() {
let totalMembers = 0;
for (const guild of client.guilds.cache) {
totalMembers = (await guild[1].members.fetch()).size;
}
var status = ' helme | Truth Or Dare'
const types = ['PLAYING', 'WATCHING', "STREAMING"]
let randomType = types[Math.floor(Math.random() * types.length)]
if (randomType === 'PLAYING') status = ` helpme | @${client.user.username}`
if (randomType === 'STREAMING') {
status = `${totalMembers} members`
}
if (randomType === 'WATCHING') {
status = `${client.guilds.cache.size} servers`
}
client.user.setPresence({activity: {type: randomType, url: "https://www.twitch.tv/", name: status}, status: 'STREAMING'});
// client.user.setPresence({activity: {type: types[Math.floor(Math.random() * types.length)], url: "https://www.twitch.tv/", name: `${status[Math.floor(Math.random() * status.length)]}`}, status: ss[Math.floor(Math.random() * ss.length)]});
}
setInterval(() => {
ll()
}, 5000)
});
// ======== Code ========
// Array of possible truth replies
const t = [
"If you could be invisible, what is the first thing you would do?",
"What is a secret you kept from your parents?",
"What is the most embarrassing music you listen to?",
"What is one thing you wish you could change about yourself?",
"Who is your secret crush?"
];
// Array of possible dare replies
const d = [
"Do a free-style rap for the next minute.",
"Let another person post a status on your behalf.",
"Hand over your phone to another player who can send a single text saying anything they want to anyone they want.",
"Let the other players go through your phone for one minute.",
"Smell another player's armpit",
"Smell another player's bare foot.",
"Eat a bite of a banana peel",
"Do an impression of another player until someone can figure out who it is.",
"Take a selfie right now and send it here",
"Say I love to your Crush"
];
const tb = [
"যদি আপনি অদৃশ্য হতে পারেন, আপনি প্রথম জিনিস কি করবেন?",
"কোন সিক্রেট কথা আপনি আপনার বাবা-মায়ের কাছ থেকে গোপন রেখেছিলেন?",
"আপনার শোনা সবচেয়ে বিব্রতকর সঙ্গীত কোনটি?"
]
const db = [
"এক মিনিটের জন্য একটি ফ্রি-স্টাইল রেপ করুন।",
"সোশ্যাল মিডিয়ায় পোস্ট দিন ``আমি একজন পাগল ব্যাক্তি``",
"এখানের কাওকে এক মিনিটের জন্য ফোন করুন।",
"তোমার ক্রাশকে মেসেজ দাও ``আমি তোমাকে ভালোবাসি`` এবং স্ক্রিনশট এখানে দাও",
]
client.on('message', message => {
if(message.content === 'ping'){
message.channel.send('pong')
}
if (message.author.bot || !message.guild || !message.content.startsWith(prefix)) return;
const command = message.content.substring(prefix.length);
// Match the command
if (command === "t") { // Truth
const truth = t[Math.floor(Math.random() * t.length)];
message.channel.send(new Discord.MessageEmbed()
.setColor('#FAA81A')
.setURL('https://discord.com/api/oauth2/authorize?client_id=874488895037911041&permissions=259846043712&scope=bot')
.setTitle("Truth")
.setDescription(truth))
message.react("