Skip to content

LvckyWorld/free-discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeScript Discord Bot

This Bot is full modular. You can use the configuration files to set everything up to suit you and your project.

Contents:

Before you can start the Bot

First you have to install NodeJS with the version 16. Now you have to open an command prompt and write the command npm i. Then npm download all required packages for you. Further you have to run this command:

npm i -g ts-node typescript

If this is done, you have to configurate your bot and the BotToken.

To configurate the BotToken you need to create a file with the name ".env" The content in ".env" file:

BOT_TOKEN = token

Then you write in the prompt the command ts-node src/index.ts

If you want to disable modules, simply write -- in front of the file like this.

image

Then the module is no longer loaded.

Commands

image

Extend the bot

If you would like to create new command, we have a very simple instruction for you. In the folder commands, you simply have to create a new file. In this file you have to put some code. We give you a simple code example:

Filename: ping.ts

/*
The new commandname is the name of the file without `.ts`.
ping.ts = prefix+ping
*/

import * as Discord from 'discord.js';
export async function execute(message: Discord.Message, args: string[], bot: Discord.Client) {
    
    // command
    if (message.member.permission.has("ADMINISTRATOR")) {
        message.reply("Pong")
    }
    
}

Restful API

The API uses urlencoded.

You have to set the verify header in the Config first.

If you done that you can set the verify header in your POST request.

Actions

  • changeusername
  • banuser

changeusername

Body

  • action => changeusername
  • name => [NEWUSERNAME]

image

banuser

Body

  • action => banuser
  • id => [USERID]
  • reason => [REASON]

image

Example Panel

We created a Web panel in PHP you can use und learn how to use the API. You just have to set the config.json right:

{
    "serverIP": "127.0.0.1",
    "port": "3000",
    "verifyHeader": "12345"
}

image image

image