AlexzanderFlores / Worn-Off-Keys-Discord-Js

469 stars 514 forks source link

Error message #10

Open JusticeKorea opened 3 years ago

JusticeKorea commented 3 years ago

Hello I have a error message in the terminal and I whould like to have some help please I tried everything but I can't find where ;/

Here is the code

const addReactions = (message, reactions) => { message.react(reactions[0]) reactions.shift() if (reactions.length > 0) { setTimeout(() => addReactions(message, reactions), 750) } }

module.exports = async (client, id, text, reactions = []) => { const channel = await client.channels.fetch(id)

channel.messages.fetch().then((messages) => { if (messages.size === 0) { // Send a new message channel.send(text).then((message) => { addReactions(message, reactions) }) } else { // Edit the existing message for (const message of messages) { message[1].edit(text) addReactions(message[1], reactions) } } }) }

Microsoft Windows [version 10.0.18363.1198] (c) 2019 Microsoft Corporation. Tous droits réservés.

C:\Users\young\OneDrive\Bureau\Bot KGB>node index.js (node:3948) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'messages' of null at module.exports (C:\Users\young\OneDrive\Bureau\Bot KGB\first-message.js:12:11) at processTicksAndRejections (internal/process/task_queues.js:97:5) (node:3948) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:3948) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. Le Bot est prêt

RaZeDeadlySword commented 3 years ago

im getting the same thing

Zenathor commented 3 years ago

Are you still having problems with this?

Have you added the following to your index.js (or whatever yours is called?):

firstMessage(client, 'channel-ID-Goes-Here', 'text-Goes-Here', ['🔥', '🚒']) }) (example emojis as reactions)