2025.2 Releases May 2025!
Check it Out!
Bit
Bit Source CodeBug & Suggestion Tracker
2024.1
  • Bit
  • Docs
  • Bit Plugins
  • Bit Changelogs
  • Bit Hosted
2024.1
  • Welcome
  • Updating
  • Commands
  • FAQ
  • Install Plugins
  • Dev
    • Create Plugins
      • Commands
      • Events
      • Run function on bot startup
      • plugin.json
      • update.json
      • Updating to Bit 2024.1
Powered by GitBook
LogoLogo

Copyright 2018-2025 Lockyz Media

On this page

Was this helpful?

Edit on GitHub
  1. Dev
  2. Create Plugins

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

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

mainFile 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.
        console.log("Successfully Loaded")
    }
}

Last updated 4 months ago

Was this helpful?