Skip to content

Common mistakes when getting started #4

Closed

Description

@Lectu

I followed the steps and I get stuck on "run node index.js" So far I received different error messages because I have changed some things (but that is when I saw that it wasn't working following the steps.

error

image

Activity

  1. devlemire commented on Apr 12, 2020

    @devlemire
    Owner

    Please try running the command npm i when you are in the C:\Users\Owner\Desktop\Discord Bot directory in the terminal.

    Cannot find module means the node_modules folder is most likely missing.

  2. Lectu commented on Apr 12, 2020

    @Lectu
    Author

    reupload

    Is it possible if you send me a video on how you do it. I've retried the steps about 4-5 times and I don't know. Sorry to be such a bother, I've just been trying to set this up for hours.

  3. devlemire commented on Apr 12, 2020

    @devlemire
    Owner

    Upon taking a closer look at your two screenshots I noticed that you have two different directories specified in the screenshots.

    • C:\Users\Owner\Desktop\Discord Bot
    • C:\Users\Owner\Desktop\Bot

    It's very important that you are in the correct directory when running these commands or they will not work.

    This new error is saying that index.js is not found. Which may mean you are in the wrong folder location. If you type dir in the console you should see index.js as one of the listed files.

  4. devlemire commented on Apr 13, 2020

    @devlemire
    Owner

    A quick trick to know where exactly you need to be is navigate to the folder using the File Explorer in Windows. You can then press the folder icon to the left of the file to get a copy-able location.

    image

    You can then go into your terminal and directly say cd DIRECTORY and that will take you right where you need to be in order to run the commands. Just replace DIRECTORY with what you copied.

  5. Repository owner deleted a comment from Lectu on Apr 13, 2020
  6. Repository owner deleted a comment from Lectu on Apr 13, 2020
  7. Repository owner deleted a comment from Lectu on Apr 13, 2020
  8. Lectu commented on Apr 13, 2020

    @Lectu
    Author

    image
    Ok, it's progress. Now I have this problem. It says I have entered an invalid token?

  9. devlemire commented on Apr 13, 2020

    @devlemire
    Owner

    So following step 2 in the README, I just download a fresh zip file of the latest release. I then extracted the zip file onto my Desktop. I then right clicked the folder and pressed open. I then clicked the folder icon to the left of the folder name in the top bar.

    image

    I copied the directory and now I can cd directly to it. I then ran npm i

    image

    I then created my .env file and added the necessary information. I now have everything I need to run it by saying node index.js

    image

  10. devlemire commented on Apr 13, 2020

    @devlemire
    Owner

    invalid token error means you didn't create a .env file in the project and then added your token and channelName variables

    Example of file existing:
    image

    Example of file contents:
    image

    The token is unique to your bot and should be copied from the bot you created in the previous steps of the README. You'll know you've pasted the right token when you run node index.js and it says the login was successful.

  11. Lectu commented on Apr 13, 2020

    @Lectu
    Author

    I'm doing something wrong.

    image

    image

    image

    Could it be that I'm doing the channel name incorrectly? I tried with General at first

  12. Lectu commented on Apr 13, 2020

    @Lectu
    Author

    I see the problem. I did not save it as a env file but I do not know how to save it as an env file

  13. devlemire commented on Apr 13, 2020

    @devlemire
    Owner

    Please notice how your .env was saved as .env.txt this makes the file not-readable by the server. When you are creating the file (in Notepad for example), you need to set the file type to All Files. Then you can save the file as just .env NOT .env.txt.

    Action Required Lectu

    Also please be aware you just exposed your token to the internet, you should re-roll your token on discord's website immediately. There is a chance a bot could of scraped your token already and use it with malicious intentions.

  14. devlemire commented on Apr 13, 2020

    @devlemire
    Owner

    As for the channelName variable it just needs to match the spelling of your channel name in the channel list on the left side.

    For example I set mine to 6mans-test-1 because that's how it is spelt there:
    image

  15. Lectu commented on Apr 13, 2020

    @Lectu
    Author

    Ok, thank you so much. I got it to work. at least it's online. But I typed !6m-help and nothing appeared. What could be the problem?

  16. Lectu commented on Apr 13, 2020

    @Lectu
    Author

    I also changed the token

  17. Lectu commented on Apr 13, 2020

    @Lectu
    Author

    image

  18. devlemire commented on Apr 13, 2020

    @devlemire
    Owner

    You have to type the commands in the channel you specified in channelName. This is to avoid the bot listening on all your text channels. So if it didn't work, there is a mismatch. I don't think you can use spaces in text channels. The bot has to be tied to a text channel.

    In your most recent screenshot it looks like you are typing in 6mans but on your last screenshot the channelName was set to Rumble 6mans Test. If you want the bot to listen in 6mans set the channelName to 6mans in your .env file.

    Please note any time you change the contents of .env, the server needs to be restarted.

  19. Lectu commented on Apr 13, 2020

    @Lectu
    Author

    I see, is it possible to add multiple text channels in the env file? If so, how do I word it

  20. devlemire commented on Apr 13, 2020

    @devlemire
    Owner

    With the current API only one text channel is supported.

  21. Lectu commented on Apr 13, 2020

    @Lectu
    Author

    Ok, I will try to see if it'll work now.

  22. devlemire commented on Apr 13, 2020

    @devlemire
    Owner

    Please open another issue if problems are still occurring. I'm going to mark this issue thread as getting started issues.

  23. changed the title [-]I cannot run the command[/-] [+]Running `node index.js` does not work. (Common mistakes when getting started)[/+] on Apr 13, 2020
  24. pinned this issue on Apr 13, 2020
  25. changed the title [-]Running `node index.js` does not work. (Common mistakes when getting started)[/-] [+]Common mistakes when getting started[/+] on Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions