collection is not defined in mongodb

Here your not declared the variable(collection) so that only you got this error.You need to declare that variable with proper collection name. For Example : If you are going to find the records in users collection under test schema you need to the follow the below code. var express = require(‘express’); var router = express.Router(); … Read more

Create JSON from a String

In JavaScript: An object literal, which uses the {} syntax, consists of a collection of property: value pairs. An array literal, which uses the [] syntax, consists of a collection of values. [begin: “test1”, end: “test2”] You have used the array syntax here, but have tried to put property: value pairs inside it. This causes … Read more

Displaying Javascript variables in HTML

Well, if you want to display a variable in HTML from JS there is a simple(ish) way to do that. First you can create the element: https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement Next, edit the created element. In the step before just give it an id (shown on the website above and below). https://www.w3schools.com/js/js_htmldom_html.asp Hope that works, Ben A.K.A BlackSky

SyntaxError: Unexpected token ‘{‘ Discord.js

You forgot the Arrow Function (=>) exports.run(message) => { const serverQueue = message.client.queue.get(message.guild.id); if (serverQueue && serverQueue.playing) { serverQueue.playing = false; serverQueue.connection.dispatcher.pause(); return message.channel.send(“⏸ La musique est en pause !”) } return message.channel.send( “Il n’y a aucune musique qui est en train de jouer !” ); } module.exports = Pause; Please consider learning JavaScript and … Read more

Discord bot simple editing its own message gives me error

The “message” variable has the exact same name ad the “message” variable in the client.on(‘message’) so change it to ‘msg’ and everything should work fine : module.exports = { name: ‘hack’, execute: function(message, args) { const user = message.mentions.users.first() || args[0]; const member = message.guild.member(user); if (member) { message.channel .send(‘Scrambling Through Database’) .then((msg) => { … Read more