Ask coding questions

← Back to all posts
Adding a prefix
GracioussBoww (0)

Im trying to add a prefix to my bot in which I keep getting an error message of the one below, if anyone can help me figure this out it'd be greatly appreciated.

Answered by WWEMONSTERMONST (25) [earned 5 cycles]
View Answer

As you have your prefix in json file, you have to import it from there. It can be done by using following code:

const { prefix } = require('./name.json')

// Or you can use this

const items = require('./name.json')
const prefix = items.prefix
GracioussBoww (0)


Thank you ever so much for helping me there, it worked