Only for people who knows Java Script please.

Discussion in 'General Discussion / Real life stuff' started by _Lovell_, Feb 11, 2018.

  1. _Lovell_

    _Lovell_ AKA Kali ;) Donator

    Messages:
    64
    Likes Received:
    8
    Minecraft:
    Denzel_Lovell
  2. ItsJerry

    ItsJerry DEAD SERVER!!! LMAO!!! Staff Member Owner

    Messages:
    3,116
    Likes Received:
    21,913
    Minecraft:
    ItsJerry
    I don't know any JavaScript but I'm going to reply anyway.

    First of all, is your script even active? Add a simple alert("hello this is working") to your script to test if it even works.

    Assuming the script is active and everything else works; In your script it says:
    Then the next line you do
    I don't see the var named prefix anywhere in the code so I'm going to assume it's some built-in Discord thing.

    I'm gonna go ahead and guess that "startsWith(config)" is the culprit and it should be "startsWith(prefix)". The script probably stops there, you can check by adding an alert before and after that line, it'll only show the first alert.
     
    Last edited: Feb 11, 2018
  3. TwageTomato

    TwageTomato Former Mod Donator

    Messages:
    977
    Likes Received:
    1,413
    Minecraft:
    Twage
    (And here I thought Harry was the only one doing code stuff for the server)
    I don't know much about discord bots (and this seems to be more discord-specific than JavaScript specific), but going along with what Jerry said, adding in little output statements at various points in your code to see which sections of code are being run will help. Sometimes the error is that the code you want never runs in the first place, and sometimes the problem is an infinite loop that won't stop running. Output statements should show you if something like that is happening, and if so, where.

    I've only begun taking courses in Javascript this semester, but I can pretty safely tell you that it's not the optimal language for discord stuff. Since I don't know the ins and outs of discord, I can't really help you any more than that. Good luck!
     
  4. _Lovell_

    _Lovell_ AKA Kali ;) Donator

    Messages:
    64
    Likes Received:
    8
    Minecraft:
    Denzel_Lovell
    I've tried it, all the other commands works, but when it to the codes under "ping" it doesn't work, but ping works...
     
  5. ItsHarry

    ItsHarry Owner Staff Member Owner

    Messages:
    9,403
    Likes Received:
    23,425
    Minecraft:
    ItsHarry
    add more debug messages
     
  6. _Lovell_

    _Lovell_ AKA Kali ;) Donator

    Messages:
    64
    Likes Received:
    8
    Minecraft:
    Denzel_Lovell
    Nvm, i fixed it, the problem was that i typed config " if (!message.content.startsWith(config)) return; " but it was supose to be
    " if (!message.content.startsWith(config.prefix)) return; " and the same thing with " var args = message.content.substring(prefix.length).split(" "); " it was supose to be " var args = message.content.substring(config.prefix.length).split(" "); "
     
  7. ItsJerry

    ItsJerry DEAD SERVER!!! LMAO!!! Staff Member Owner

    Messages:
    3,116
    Likes Received:
    21,913
    Minecraft:
    ItsJerry
    that's what I said
     
  8. _Lovell_

    _Lovell_ AKA Kali ;) Donator

    Messages:
    64
    Likes Received:
    8
    Minecraft:
    Denzel_Lovell
    Ohh, lol, i didn't understand that..