Starting your bot

Assuming you have created your bot, you can now start coding and get your bot online! Lets start by adding a configuration file.

Creating a configuration file

Now that you have you bot token while getting your bot tokenopen in new window, we can not create a config file for the Guilded.TS framework to read.

WARNING

This is required for the Guilded.TS framework to be able to login with your bot's token.

Create a gtsconfig.{json,js,ts,yml,yaml} in the root of your project and add the following:

{
    "$schema": "https://guildedts.js.org/media/gtsconfig-schema.json",
    "token": "token",
    "prefix": "!"
}
 
 
 
 
 
import { ClientConfig } from '@guildedts/framework';

export default {
    token: 'token',
    prefix: '!'
} as ClientConfig;
 

 
 
 
 
module.exports = {
    token: 'token',
    prefix: '!'
}
 
 
 
 
export default {
    token: 'token',
    prefix: '!'
}
 
 
 
 
token: token
prefix: '!'
 
 

.gitignore

It is important to ignore files and folders that are not needed or have sensetive information like your bot token. If you are committing your progress to a platform like GitHubopen in new window, create a .gitignore file in your root directory then add the following inside:

node_modules
gtsconfig.{json,js,ts,yml,yaml}
 
 

TIP

node_modules should never be committed to your repository considering that you can generate this folder by installing your dependencies. Your dependencies are saved in the package.json file.

Starting your bot

Now that you probably have your configuration done by now, you can now finally get started with getting your bot online! We have two options for Starting your bot:

  1. Use the CLI from the framework
  2. Create a custom client

TIP

If you plan on writing your commands/events in TypeScript, we recommend creating a custom client and running it with ts-nodeopen in new window.

Using the CLI

Run the following command in the terminal:

gts dev
 
gts start
 

Creating a custom client

Create a index.{js,ts} file in the root of your project and add the following:

import Client from '@guildedts/framework';

const dev = process.argv.includes('--dev');

new Client({ dev });
 

 

 
const { Client } = require('@guildedts/framework');

const dev = process.argv.includes('--dev');

new Client({ dev });
 

 

 
import Client from '@guildedts/framework';

const dev = process.argv.includes('--dev');

new Client({ dev });
 

 

 

Examples

Now that you have created a custom client, you can now run node index.js (ts-node index.ts for ts-nodeopen in new window).

TIP

You can add "main": "index.js" in your package.json so you can use node .. You can also include a script like "scripts": { "start": "node ." } ("scripts": { "start": "ts-node index" } for ts-nodeopen in new window) to be able to run npm start or npm run start.

You can also stop the current process by pressing Ctrl + C and then press the up arrow to show the last command in your terminal.