Basic Usage
Basic Usage
Create a new directory and open a command prompt or a terminal.
First, run npm i @n-f9/quack.js
to install the package. Also, it would be a great time to install dotenv with npm i dotenv
to store your Discord bot token (this is optional, however, recommended).
Next, open your favorite code editor or IDE and create a source directory with an index.js
in the root
Example Project Structure
src/
βββ commands/
β βββ quote.js
β βββ help.js
βββ events/
β βββ ready.js
βββ triggers/
β βββ links.js
β βββ mentions.js
index.js
The index.js should follow this format
import 'dotenv/config'
import { QuackJS, QuackJSUtils } from '@n-f9/quack.js'
const Quack = new QuackJS(process.env.TOKEN, {
backups: [
{
file: 'database.sqlite',
scheduling: '0 0 23 * * *'
}
],
logsFolder: true,
})
const files = QuackJSUtils.GetFiles('./src')
for (const file of files) {
const execute = (await import('./' + file)).default
execute(Quack)
}
Quack.Start(Quack)
And your modules in your source directory should follow this basic format
export default (QuackJS) => {
...
}
To start the bot simply run node .
or if you want to run this in the background you can install something like forever.
Last updated