OldStarchy / DashBot

Apache License 2.0
1 stars 2 forks source link

DashBot

CircleCI codecov.io

A chatbot that does whatever I feel like implementing at the time.

What can it do

Dashbot will listen for messages on all text channels it has access to and do some simple matching (usually a regex test) to figure out which Interaction or Command to run. Interactions and Commands are registered in the startup/registerAllComponents.ts file.

See the documentation in each Interaction to see what it does, however, some notable ones are

How to use

This project uses Yarn, information on how to install and use yarn can be found here;

  1. Clone this repo somewhere!

  2. Install the dependencies with yarn by running yarn install in the project root.

  3. Build the project with yarn build, you should now have a dist folder.

  4. Create a config file dashbot.config.js. The only required property is discordBotToken

    /* eslint-disable @typescript-eslint/triple-slash-reference */
    /// <reference path="src/DashBotConfig.d.ts" />
    
    /** @type DashBotConfig */
    const Config = {
        imgurClientId: '',
        servers: [
            {
                type: 'discord',
                botToken: '',
            },
            {
                type: 'minecraft',
                logClient: {
                    type: 'tail',
                    logFilePath: '/path/to/minecraft/logs/latest.log',
                },
                rcon: {
                    host: '127.0.0.1',
                    port: 1234,
                    password: 'example password',
                },
            },
        ],
        tls: {
            maintainerEmail: 'your.email@exmaple.com',
            packageAgent: 'dashbot/1.0.0',
        },
    };
    
    module.exports = Config;

    This readme may get out of date, I suggest you check the type declaration for the most up to date specification.

    To get a bot token, you need to go to the Discord Developers website. You need to create an Application, then go to the Bot page from the menu on the left and create a bot. From there you can get your bot token and put it in the config.

  5. Add your bot to your server

    So now you're almost set, but to actually test, you need to add your bot to a server, to do this you'll need to get the url below and add your client ID which you can find on your Discord Application page.

    https://discordapp.com/api/oauth2/authorize?permissions=515136&scope=bot&client_id=YOUR_CLIENT_ID

    Put your client id in there, and open it up. You'll get a page which will allow you to add your bot to any server you have admin control over.

  6. Put the config file in the storage location (of your choice), for convenience i usually leave it in the project root.

  7. Now you can run the program, in the root of the project run

    node dist/main.js --storage "."

    The storage flag tells dashbot where to load the config from, as well as where to store its statistics, and log files. By default it will be a directory named "storage".

  8. If everything worked correctly, you can go have a look in discord, your bot should be online. Now say something like roll d20 or joke to activate one of its responses.