0

I am currently working on a Discord Bot that should verify a Roblox account. My script is ready so far the command "-verify" can also be executed but then an error occurs:

(node:22872) DeprecationWarning: The message event is deprecated. Use messageCreate 
instead
(Use `node --trace-deprecation ...` to show where the warning was created)
C:\Users\Foxii\ExoConnect\node_modules\discord.js\src\rest\RequestHandler.js:298
    throw new DiscordAPIError(data, res.status, request);
        ^

DiscordAPIError: Cannot send an empty message
at RequestHandler.execute 
(C:\Users\Foxii\ExoConnect\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push 
(C:\Users\Foxii\ExoConnect\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async TextChannel.send (C:\Users\Foxii\ExoConnect\node_modules\discord.js\src\structures\interfaces\TextBasedChanne 
l.js:171:15) {
method: 'post',
path: '/channels/684428068579966976/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: []
 }
}
 [nodemon] app crashed - waiting for file changes before starting...

I don't know how to fix it. How can I define them all? Could anyone help me? This is my script:

const BaseCommand = require('../../utils/structures/BaseCommand');
const Discord = require('discord.js');
const noblox = require('noblox.js');

module.exports = class VerifyCommand extends BaseCommand {
 constructor() {
  super('verify', 'verification', []);
 }

async run(client, message, args) {
function sendVerificationMessage(Title, Description, Color) {
  const Embed = new Discord.Message.Embed()
    .setAuthor('Exo Game Studios Verification')
    .setTitle(Title)
    .setDescription(Description)
    .setColor(Color)
    .setFooter('This prompt will cancel in 2 minutes.')
    .setTimestamp()
  message.channel.send(Embed);
}

message.channel.send('**Starting verification process...**').then(editedMsg => {
  editedMsg.edit('**Awaiting prompt**');
  editedMsg.delete();

  function Generate() {
    let text = '';
    let randomstuff = ['ExoConnectToken BvVha1XjRJxJ8h', 'ExoConnectToken ghBFuuEw6Zfa72 ', 'ExoConnectToken 1f85xQswyfMgz7', 'ExoConnectToken WLMY59s7ujKysj', 'ExoConnectToken G7GrQNbWNjDqck', 'ExoConnectToken Gh7eTusmu5gKDk', 'ExoConnectToken K1pPedqyfZ8Z2r', 'ExoConnectToken pSkr6x6VWWaWMw', 'ExoConnectToken 1Qp3HgRJuZvHrj', 'ExoConnectToken Q6b4Qg6QG7TBSH',];
    text += randomstuff[Math.floor(Math.random() * randomstuff.length)];
    return text;
  }
  const filter = m => m.author.id === message.author.id;
  const collector = message.channel.createMessageCollector(filter, {
    max: '1',
    maxMatches: '1',
    time: '120000',
    errors: ['time']
  })
  const embed = new Discord.MessageEmbed()
    .setTitle('Exo Game Studios Verification')
    .setDescription('Please enter your ROBLOX username.')
    .setColor('BLUE')
    .setFooter('This prompt will cancel in 2 minutes.')
    .setTimestamp()
  message.channel.send(embed);
  collector.on('collect', m => {
    if (m.content.toLowerCase() === 'cancel') {
      sendVerificationMessage('Prompt', 'Cancelled the verification prompt.', 'RED')
      return;
...

The only thing I found to the topics (content, nonce, etc.) is in the TextBasedChannel.js:

Base options provided when sending.
@typedef {Object} BaseMessageOptions
@property {boolean} [tts=false] Whether or not the message should be spoken aloud
@property {string} [nonce=''] The nonce for the message
@property {string} [content=''] The content for the message
@property {MessageEmbed[]|APIEmbed[]} [embeds] The embeds for the message
(see [here](https://discord.com/developers/docs/resources/channel#embed-object) for more details)
@property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
(see [here](https://discord.com/developers/docs/resources/channel#allowed-mentions-object) for more details)
@property {FileOptions[]|BufferResolvable[]|MessageAttachment[]} [files] Files to send with the message
@property {MessageActionRow[]|MessageActionRowOptions[]} [components]
Action rows containing interactive components for the message (buttons, select menus)
@property {StickerResolvable[]} [stickers=[]] Stickers to send in the message

1 Answer 1

1

Sending embeds changed in V13 try this:

 message.channel.send({embeds: [embed]});
Sign up to request clarification or add additional context in comments.

1 Comment

It's kinda working now. But when i write "-verify" the bot gives me the embed like 5 times in a row. So it's really random sometimes it's just one time (How i want it) but sometimes also 2,3 or 4 times. The embed is displayed to me but the same error occurs and the bot does not want to take any further steps in the verification process that it should actually have. But the "content" is different now. It says: json: { content: 'Awaiting prompt', That's what it says in the 23 line of my script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.