Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message #10

Open
JusticeKorea opened this issue Nov 29, 2020 · 2 comments
Open

Error message #10

JusticeKorea opened this issue Nov 29, 2020 · 2 comments

Comments

@JusticeKorea
Copy link

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
Copy link

im getting the same thing

@Zenathor
Copy link

Zenathor commented Feb 6, 2021

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants