I recently decided to upgrade my discord js library to v12. I wanted to when someone turns on the game (Golf With Your Friends) he gets a role. But I can’t program it in discord js v12. Can you help me? Here is my code in v11: Answer Here’s a guide from discordjs.guide on updating from v11 to v12: https://discordjs.guide/additional-info/changes-in-v12.html#managers-cache
Tag: discord.js
Discord.JS AwaitMessages
In the line of “message.channel.awaitmessages” i think the code is bad writted, the thing i want to do is to await for 1 message that is a number btw 0 and 23. Here is the corresponding code : Answer You need to update your filter for this to work: Additionally the .then() needs a collected too. It would also be
Discord.js RichEmbed field values “empty” even thought they are not. messageUpdate
So basically I have been making an log for message edit. The aim of the function is to write in modlog channel if someone edits the message. Also I wanted bot to write message before and after update. Here is the code: The console error : What the bot does: -Bot executes the function exactly as planned. I have all
How can I send an code block in discord.js embed?
I am trying to send an embed with a codeblock. In discord a code block is set with three ` What can I do to put oldMessage.cleanContent and newMessage.cleanContent in a code block? Here is my code: Answer You can do it in two ways both are correct: You just comment the comma with quotation Or you can comment it
SQL UPDATE event not working correctly with discord.js via message event
I’ve been trying over the past days to get an SQL UPDATE event to work correctly with discord.js using the mysql npm package. All the login details and table, column names are correct. This is meant to update the integer every time a message is sent in the Discord text channel. I have tried multiple types of the UPDATE even
Discord bot get number of users in all channels
Im not good with javascript but i have been trying to get count number of users in all voice channels. For example: if 2 users in ‘voice channel 1’ and 1 user in ‘voice channel 2’ I want to print number 3 in console which is all users in voice channels. This code print all members(online/offline) name in console, But
Is there a way to make this code shorter? (reaction collector)
I tried to make one filter for both collectors but still have to type this (x,y,z) => filter(x,y,z,’⏪’) Answer You can make a higher-order function, one that takes in the character you’re looking for and returns a function that takes three arguments (reaction, user, and c, corresponding to your current (x, y, x) =>) and returns the appropriate filter operation.
Sending message to specific channel based on an argument
I have searched up and found multiple forum posts on both Reddit and StackOverflow where users are asking how to send a message to the specific channel, but I cannot find one where you can send to a specific channel using an Argument. What I mean is that you use I have been testing around with this “function” and have
How to create a role with discord.js
I’ve been trying to make a discord bot using discord.js, but I can’t seem to find any documentation on how to create a role that works in 2018. All the ones I can find that work, no longer work as they have removed the referenced function. In https://discord.js.org/#/docs/main/stable/class/Role there is no mention of a createRole(“role”, “roleName”); type function. If anyone
How can I get my bot to send a message to another channel?
so I have a bot that takes whatever I say when I do the command /say and deletes my message. Since it still technically sends my message, people will see it through notifications and can tell that it was me that got the bot to send the text. I am doing this as a fun and troll thing with my