I would like to send a message every 5 seconds and that the user who reacts first gives him 10 coins.
This code does not work, I got now an error back : Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'channels') on the line : const channel2up22 = guild.channels.cache.get('935549530210983976');
As much as I've watched the doc, I can't do it, I also specify that my Guild ID and my Channel id is correct, I checked it just before posting the question.
Would you have a way to remedy this error,? Thank you in advance!
const Discord = require("discord.js");
const Client = new Discord.Client;
const fs = require('fs')
const guild = Client.guilds.cache.get('925830522138148976');
const channel2up22 = guild.channels.cache.get('935549530210983976');
const userCoin = JSON.parse(fs.readFileSync('Storage/userCoin.json', 'utf-8'));
// placing the function outside of a listener and can be called at anytime
function doSomething() {
const Embed = new Discord.MessageEmbed()
.setTitle("Wild Gift