Code a Javascript Discord Bot: Part 1 – Getting Set Up




Premiere is a dream to edit in, and discord.js is very simple to teach. Looking forward to the future of this series!

Downloads:
❯❯ Visual Studio Code: https://code.visualstudio.com/
❯❯ Node.js: https://nodejs.org/en/

Websites:
❯❯ Discord Developer Page: https://discordapp.com/developers/
❯❯ Discord Permission Calculator: https://discordapi.com/permissions.html

❯❯ Github Gists (for posting your code): https://gist.github.com/

Original source


50 responses to “Code a Javascript Discord Bot: Part 1 – Getting Set Up”

  1. If you get a never ending reply from your bot, you can store the bot's client id as shown in the App page inside of your application and then check that id against `message.author.id` to make sure they are not the same, and then deliver a reply from your bot. If you don't check the id behind the message, your bot will endlessly reply to itself if you're not checking the content. It's a much safer bet to check ids versus just content.

  2. it dont work after i put node . it says: internal/modules/cjs/loader.js:169
    throw e;
    ^

    SyntaxError: Error parsing C:UsersawesoDocumentsOh yeahpackage.json: Unexpected token ~ in JSON at position 0
    at JSON.parse (<anonymous>)
    at readPackage (internal/modules/cjs/loader.js:165:49)
    at tryPackage (internal/modules/cjs/loader.js:174:13)
    at Function.Module._findPath (internal/modules/cjs/loader.js:284:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:578:25)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:279:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:752:3)

  3. When you create the folder that holds your code, does where you place it affect the bot? because I cant get npm init to work and I cant find the place on my computer to put the folder.

  4. for the people in the comments saying that "npm init isnt working", or that youre getting and error saying "'npm' is not recognized as an internal or external command, operable program or batch file", or that node . doesn't work, make sure your terminal is set to cmd (command line) and NOT powershell

  5. Error: Cannot find module 'C:Users…DownloadsHoward The Alien'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:266:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)

  6. Mine says this: internal/modules/cjs/loader.js:583
    throw err;
    ^

    Error: Cannot find module 'discord.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:UsersOwnerDocumentsSuperiorStudiosBotindex.js:1:79)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Leave a Reply