Run function on bot startup

You can run create features scheduled to run when the bot starts.

In order to allow for this you'll need to fulfill some prerequisites

plugin.json required parameters

has_index MUST be marked as true. If you don't mark this true Bit will skip the file

main_file MUST be set to the FULL name of your file. Bit uses index.js by default, it's highly recommended you keep it that way.

start_function in your main_file. The actual function that starts on bot startup MUST be start_function.

Start index.js example

const core = require('bit/core')

// In order to allow the bot to read the start_function it MUST be set as an export.
module.exports = {
    // Defines the start_function
    start_function: function start_function() {
        // Calls bit core and tells it to create an info log telling the user the plugin has loaded.
        core.log(0, "Bit Core", true, "Successfully Loaded!")
    }
}

Last updated

Was this helpful?