Prefix not working

I’m trying to make a bot for my discord server and I’m following the guide… but when is comes down to prefixes… I keep getting a message saying “prefix is not defined” I copied the doc example

It also said at the beginning to create a config.json file which I did and put what I was supposed to. not really good at coding so I’m trying to learn as best I can but I need help

Can you show us your full code plus the JSON file?

try removing “” from line 14 and see if anything changes

now it says "Parsing error: Unexpected Token

ok hold on i analyzed more and i noticed that every instance you have “prefix” you need a config before it since you dont define prefix itself

1 Like

so to activate my bot on discord the keyword is v. ; so instead of actually putting prefix I need to use v.??

no every instance you have “prefix”, change it to “config.prefix”

That should work. I’ve used glitch discord bot coding forever and you are right.

1 Like

assuming you meant me, i skimmed over it at first and got it wrong L but we all good now. hope the dude’s code works now

yea. config.prefix works for me all of the time. the dude has to define config first.

he already defined config, he just could’ve defined config.prefix as prefix or whatever lmfao

Nice… it worked. Thank you so much

1 Like

So you don’t have to put config.prefix on every line you can do this: let prefix = config.prefix around the client.on. Just to make it shorter and not config.prefix every command you make :slight_smile:


yea of course

yes, exactly

Just to make it shorter :slight_smile:. Have a nice day.

1 Like