# Welcome

Bit is a Discord Bot Framework developed by Lockyz Media!

This bot relys on plugins in order to give users as much customisability as possible.

Source Code: <https://github.com/Lockyz-Media/bit>

Created by Lockyz Media [https://lockyzmedia.com/](https://lockyzmedia.com)

## Updating to Bit 2025.1?

Bot: [Updating](/updating)

[Plugin Developers](https://bit.lockyzdev.net/docs/dev/create-plugins/updating-to-bit-2025.1)

## Want to make a plugin?

Simply follow our [guide and documentation](https://bit.lockyzdev.net/docs)


# Updating

#### Bit 2025.1 to Bit 2025.2 <a href="#bit-2024.1-to-bit-2024.2" id="bit-2024.1-to-bit-2024.2"></a>

**Things to remember**

* Make sure ALL plugins are updated to Bit 2025.2
* Delete every single file and folder from Bit excluding the plugins folder (though remove the bit-core plugin).

**Update ALL plugins to their latest versions**

All plugins must be updated for use in Bit 2025.2

**Deploy commands**

Run `node deploy.js` to deploy the bots commands.

**And you're done**

Aside from plugin-specific updates, you should now be fine to run Bit. Simply use the `node bit.js` command and you're all set!


# Commands

As part of the Bit Core plugin, Bit (without any other plugins) only has the following commands

| Command | Usage    | Description                               |
| ------- | -------- | ----------------------------------------- |
| Info    | /info    | Get advanced information about the bot    |
| Plugins | /plugins | List all plugins available within the bot |


# FAQ

## Where can I get support?

We have a whole discord server for support which you can [find here](https://discord.gg/NgpN3YYbMM)

## Will this give me a virus?

Nope, unless you found the "source" code on a shady site that has inserted a virus.

## Can you add feature X?

You're always welcome to suggest features on our [Discord Server](https://discord.gg/NgpN3YYbMM). Or you can make a pull request/issue on our [GitHub repo](https://github.com/Lockyz-Media/bit)


# Install Plugins

Follow the documentation listed on the plugins documentation page. Or follow the basic example below (some plugins will require installing specific node.js modules and will not work if these modules are not installed prior)

Simply unzip the plugins folder into the bit/plugins folder.

If a plugin adds a config, please follow the plugin authors instructions on using it. Some plugins do not use the configs folder yet.

You should then run the deploy script `deploy.js`


# Welcome

Bit is a completely customisable Discord Bot

Source Code: <https://github.com/Lockyz-Media/bit>

Created by Lockyz Media [https://lockyzmedia.com/](https://lockyzmedia.com)

## Updating to Bit 2025.2?

For the Bot [Updating](/docs/updating)

For Plugin Developers [Updating to Bit 2025.2](/docs/dev/create-plugins/updating-to-bit-2025.2)

## Wanting to make a plugin?

Simply follow our guide [Create Plugins](/docs/dev/create-plugins)


# Updating

#### Bit 2025.1 to Bit 2025.2 <a href="#bit-2024.1-to-bit-2024.2" id="bit-2024.1-to-bit-2024.2"></a>

**Things to remember**

* Make sure ALL plugins are updated to Bit 2025.2
* Delete every single file and folder from Bit excluding the plugins folder (though remove the bit-core plugin).

**Update ALL plugins to their latest versions**

All plugins must be updated for use in Bit 2025.2

**Deploy commands**

Run `node deploy.js` to deploy the bots commands.

**And you're done**

Aside from plugin-specific updates, you should now be fine to run Bit. Simply use the `node bit.js` command and you're all set!


# Commands

As part of the Bit Core plugin, Bit (without any other plugins) only has the following commands

| Command | Usage                | Description                               |
| ------- | -------------------- | ----------------------------------------- |
| Info    | /info                | Get advanced information about the bot    |
| Plugins | /plugins             | List all plugins available within the bot |
| Plugin  | /plugin {pluginName} | Lists information on a specific plugin    |


# FAQ

## Where can I get support?

We have a whole discord server for support which you can [find here](https://discord.gg/NgpN3YYbMM)

## Will this give me a virus?

Nope, unless you found the "source" code on a shady site that has inserted a virus.

## Can you add feature X?

You're always welcome to suggest features on our [Discord Server](https://discord.gg/NgpN3YYbMM). Or you can make a pull request on our [GitHub repo](https://github.com/Lockyz-Media/bit)


# Install Plugins

Follow the documentation listed on the plugins documentation page. Or follow the basic example below (some plugins will require installing specific node.js modules and will not work if these modules are not installed prior)

Simply unzip the plugins folder into the bit/plugins folder.

If a plugin adds a config, please follow the plugin authors instructions on using it. Some plugins do not use the configs folder yet.

You should then run the deploy script `deploy.js`


# Create Plugins

Get started making plugins for Bit

## Getting Started

1. Download our example plugin
2. Customise it to your hearts content
3. Email us at <lockyzmedia@gmail.com> to get your plugin certified

These guides assume you already know basic node.js and/or how to create a Discord bot using discord.js


# Commands

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for commands found here <https://discordjs.guide/creating-your-bot/slash-commands.html#individual-command-files>
{% endhint %}

### Command Example <a href="#command-example" id="command-example"></a>

<pre class="language-javascript"><code class="lang-javascript"><strong>const { EmbedBuilder, version: discordVersion, SlashCommandBuilder } = require('discord.js')
</strong>const moment = require('moment');
require('moment-duration-format');
const language = require('../../../config.json')

module.exports = {
    cooldown: 5,
    data: new SlashCommandBuilder()
        .setName('info')
        .setNameLocalizations({
            de: 'info',
            fr: 'info',
        })
		.setDescription('Get advanced information about the bot.')
        .setDescriptionLocalizations({
            de: 'Erhalten Sie erweiterte Informationen über den Bot.',
            fr: 'Obtenez des informations avancées sur le bot.',
        })
        .setIntegrationTypes(0,1)
        .setContexts(0,1,2),
	async execute(interaction) {
        const client = interaction.client
        var lan = language;
        const locale = require('../../../locale/'+lan+'.json')

        const botUptime = moment.duration(client.uptime).format(' D [days], H [hrs], m [mins], s [secs]');
        const memUsage = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2);
        const guildSize = client.guilds.cache.size.toString();
        const userSize = client.users.cache.size.toString();
        
        var d = new Date();
        var n = d.getFullYear();
        const embed = new EmbedBuilder()
            .setTitle(locale.bot.name)
            .setDescription(locale.bot.description)
            .addFields(
                { name: locale.misc.support, value: "https://discord.gg/NgpN3YYbMM", inline: true },
                { name: locale.misc.developer, value: "Robin Painter", inline: true },
                { name: locale.misc.guilds, value: guildSize, inline: true },
                { name: locale.misc.users, value: userSize, inline: true },
                { name: locale.misc.uptime, value: botUptime, inline: true },
                { name: locale.misc.memory, value: `${Math.round(memUsage)} MB`, inline: true },
                { name: locale.misc.discordJS, value: `v${discordVersion}`, inline: true },
                { name: locale.misc.node, value: `${process.version}`, inline: true },
                { name: locale.misc.version, value: "v5.2.0", inline: true },
                { name: locale.misc.bugTracker, value: "https://tracker.lockyzdev.net/set_project.php?project_id=5", inline: true },
            )
            .setFooter({ text: locale.misc.copyrightText.replace('{year}', n)});
        interaction.reply({ embeds: [embed] })
	}
};
</code></pre>


# Events

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for that in the meantime <https://discordjs.guide/creating-your-bot/event-handling.html>
{% endhint %}


# Plugin Requirements

If your plugin uses functions from another plugin, you can make sure to warn the user by making use of Bits plugin requirements system!

## Setup

Within your plugins plugin.json file you can find a field for defining your plugins requirements, these requirements will be listed when the plugin loads into bit, and when you run the plugins command.

```json
{
    "requirements": {
        "bit": {
            "version": "2025.1.0",
            "level": 0
        },
        "jupiter": {
            "version": "2025.1.0",
            "level": 2
    }
}
```

An example of a plugin requiring Bit and Jupiter

## Requirement Levels

There are 4 different levels of Bit requirements, these can be used to stop the plugin from loading if the plugin and specific version is not present, and can be used to stop the plugin from loading if the plugin IS present.

Level 0, requires the external plugin at that specific version be loaded for your plugin to work.

Level 1, requires the external plugin to be loaded regardless of said external plugins version

Level 2, is basically a soft requirement, the external plugin is not "required" but part of your plugin will not work without it. (You should include a check for this in your code, however a feature will be added to Bit Core to aid in this in the future.)

Level 3, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.


# Functions

{% content-ref url="/pages/2bTvkZLNJ0j0wEITc414" %}
[bit/plugins](/docs/dev/create-plugins/functions/plugins)
{% endcontent-ref %}

{% content-ref url="/pages/qX27LS6BGv6xxM4aZR9L" %}
[bit/core](/docs/dev/create-plugins/functions/bit-core)
{% endcontent-ref %}


# bit/plugins

As part of Bit 2025.2 we added a brand new suit of functions to interact with Bits plugin system.

These functions can be imported with the following code at the top of your code

```javascript
const plugins =  require("bit/plugins");
```

Theres a few different functions you can run with this import...

### [.is\_active(id, version)](/docs/dev/create-plugins/functions/plugins/.is_active-id-version)

Gets whether the plugin defined by the id of version is active

### [.find(id)](#find-id)

Find a specific plugin defined by id

### [.list()](/docs/dev/create-plugins/functions/plugins/.list)

Shows a list of all installed plugins

### [.count()](/docs/dev/create-plugins/functions/plugins/.count)

Counts all the plugins installed, and outputs the number.


# .is\_active(id, version)

The is\_active function can be used to detect if a plugin is installed, and whether it matches a specific version. This function should be used in conjunction with bits soft-requirements system to block parts of your plugin to users who may not have all the required plugins.

The version paramater is optional and can be ommitted.

```javascript
plugins.is_active(id, version)
```

Example with Bit: Core 2025.2.0 installed

```javascript
const reqMet = plugins.is_active('bit-core', '2025.2.0');

console.log(reqMet)

// Output if everything matches
/*
{
    "installed": true,
    "activated": true,
    "match_version": true
}
*/

// Output if Bit: Core is not installed
/*
{
    "installed": false,
    "activated": null,
    "match_version": null
}
*/

// Output if Bit: Core is installed but not on the right version.
/*
{
    "installed": true,
    "activated": true,
    "match_version": false
}
*/

// Output if Bit: COre is installed but disabled
/*
{
    "installed": true,
    "activated": false,
    "match_version": null
}
*/
```


# .find(id)

`plugins.find(id)` is used to find a specific plugin and it's information.

If the plugin cannot be found within the plugins database, it'll return a status code of 404.

This function will return an array of the plugins info and/or the status of the search.

```javascript
plugins.find(id)
```

Example use

```javascript
const plugins = require('bit/plugins');

const pluginInfo = plugins.find('bit-core')

if(!pluginInfo.status.code === 404) {
    console.log(`Plugin with an id of 'bit-core' cannot be found`)
} else {
    console.log(`Plugin with an id of 'bit-core' was found!`)
    console.log(`Plugin Name: ${pluginInfo.plugin.name}`)
    console.log(`Plugin ID: ${pluginInfo.plugin.id}`)
    console.log(`Plugin Version: ${pluginInfo.plugin.version}`)
    console.log(`Plugin Has Index?: ${pluginInfo.plugin.has_index}`)
    console.log(`Plugin Disabled: ${pluginInfo.plugin.disabled}`)
    console.log(`Plugin Requirements: ${pluginInfo.plugin.requirements}`)
}

// Output if bit-core is found
/*
Plugin with an id of 'bit-core' was found!
Plugin Name: Bit: COre
Plugin ID: bit-core
Plugin Version: 2025.2.0
Plugin Has Index?: true
Plugin Disabled: false
Plugin Requirements: {
    "bit": {
        "version": "2025.2.0",
        "level": 0
    }
}
*/

// Output if bit-core is not found
/*
Plugin with an id of 'bit-core' cannot be found
*/
```


# .list()

{% hint style="danger" %}
This guide is UNFINISHED.
{% endhint %}

Shows a list of all installed plugins

```javascript
plugins.list()
```


# .count()

Counts all the plugins installed, and outputs the number.

```javascript
plugins.count()
```

Example

```javascript
const plugins = require('bit/plugins');

const count = plugins.count()

console.log(count)

// Output
/* 
0
*/
```


# bit/core

### [.log(type, "Plugin Name", force\_console, "Log")](/docs/dev/create-plugins/functions/bit-core/logs)

Sends a log in the "standard" format for Bit.

### [.find\_emoji(unicode\_emoji)](/docs/dev/create-plugins/functions/bit-core/.find_emoji-unicode_emoji)

Returns an emoji in a format Discord can read.

### [.add\_intent(IntentGatewayBits)](/docs/dev/create-plugins/functions/bit-core/.add_intent-intentgatewaybits)

Adds an intent to the bot. MUST BE RUN WITHIN THE define\_intents FUNCTION IN YOUR main.js FILE

### [.install\_module(npm\_package)](/docs/dev/create-plugins/functions/bit-core/.install_module-npm_package)

Installs a node module using npm


# .log(type, "Plugin Name", force\_console, "Log")

Bit employs a custom logging system. To use bits new logging system you simply have to import bit/core and then follow the function structure.

```javascript
const core = require('bit/core');

// Log ERROR as Bit Example plugin
core.log(2, "Bit Example", false, "Something Broke")
// ^ Will output "[ERROR] Bit Example: Something Broke"

// Log WARNING as Bit Example Plugin
core.log(1, "Bit Example", false, "Something Broke")
// ^ Will output "[WARNING] Bit Example: Something Broke"

// Log INFO as Bit Example Plugin
core.log(0, "Bit Example", false, "Something Broke")
// ^ Will output "[INFO] Bit Example: Something Broke"
```

You can also force the log to appear in the bots console regardless of the users settings

```javascript
const core = require('bit/core');

// Force ERROR from Bit Example Plugin to appear in the bots console
core.log(2, "Bit Example", true, "Something Broke")
// ^ Will ALWAYS output "[ERROR] Bit Example: Something Broke"

// Don't Force ERROR from Bit Example Plugin to appear in the bots console
core.log(2, "Bit Example", false, "Something Broke")
// ^ Will only output "[ERROR] Bit Example: Something Broke" if the user has error logs turned on for the console
```


# .find\_emoji(unicode\_emoji)

{% hint style="danger" %}
This guide is UNFINISHED.
{% endhint %}

Returns an emoji in a format Discord can read.


# .add\_intent(IntentGatewayBits)

Adds an intent to the bot.

MUST BE RUN WITHIN THE define\_intents FUNCTION IN YOUR main.js FILE

Example

```javascript
const core = require('bit/core');
const { GatewayIntentBits } = require('discord.js');

module.exports = {
    define_intents: function define_intents() {
        // Adds the MessageContent intent
        // I recommend against adding this intent unless ABSOLUTELY required
        // This intent allows the bot to see Message Content and is ABSOLUTELY dangerous
        core.add_intent(GatewayIntentBits.MessageContent)
    }
}
```


# .install\_module(npm\_package)

{% hint style="danger" %}
This guide is UNFINISHED.
{% endhint %}

Installs a node module using npm


# 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

```javascript
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!")
    }
}
```


# Global Exports

{% hint style="danger" %}
WARNING: This feature is EXPERIMENTAL.

Please exercise caution when using this feature!
{% endhint %}

Added in Bit 2025.2, plugins can now define global exports that can be run within other plugins.

All you need is an index.js file within your main plugin directory, and different functions within your module.exports.

Example

```javascript
module.exports = {
    test_function: function test_function() {
        console.log("Test Works!!!!")
    }
}
```

This can then be imported and used according to the example below

```javascript
const test_plugin = require("bit/plugin/test-plugin");

test_plugin.test_function();

// Outputs "Test Works!!!!"
```

This feature should be VERY useful for plugin developers who want to interact with other plugins.


# Definable Intents

{% hint style="danger" %}
WARNING: This feature is EXPERIMENTAL.

Please exercise caution when using this feature!
{% endhint %}

Added in Bit 2025.2, you can now define intents to be added to the bot before the bot starts.

This feature adds a new function that runs when the bot first starts `define_intents()` runs BEFORE the Discord client is defined and started, meaning that any discord.js specific functions DO NOT work.

This function can be used to run literally any code, however plugins will NOT be certified if they run any code within this function that isn't used to define an intent, or a node module.

Within your plugin.json file you'll need to set `has_intents` and `has_index` to true, you'll also need to define your `main_file`

Example, defining the MessageContent privileged intent

{% code overflow="wrap" %}

```javascript
const core = require('bit/core');
const { GatewayIntentBits } = require('discord.js');

module.exports = {
    define_intents: function define_intents() {
        // Adds the MessageContent intent
        // I recommend against adding this intent unless ABSOLUTELY required
        // This intent allows the bot to see Message Content and is ABSOLUTELY dangerous
        core.add_intent(GatewayIntentBits.MessageContent)
    }
}
```

{% endcode %}


# Definable Node Modules

{% hint style="danger" %}
WARNING: This feature is EXPERIMENTAL.

Please exercise caution when using this feature!
{% endhint %}

{% hint style="danger" %}
This guide is UNFINISHED.
{% endhint %}


# plugin.json

All the plugin.json options for a Bit Core Plugin and what they're used for

<table data-full-width="true"><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th>Default Value</th></tr></thead><tbody><tr><td>name</td><td>The plugins name</td><td>string</td><td>Bit Core</td></tr><tr><td>id</td><td>The plugins ID</td><td>string (requirements below)</td><td>bit-core</td></tr><tr><td>developer</td><td>The plugins developer</td><td>string</td><td>Lockyz Media</td></tr><tr><td>version</td><td>What version the plugin is</td><td>string</td><td>2024.1.0</td></tr><tr><td>support</td><td>A place to go to get support</td><td>string</td><td><a href="https://github.com/Lockyz-Media/bit/issues">https://github.com/Lockyz-Media/bit/issues</a></td></tr><tr><td>update_url</td><td>A url pointing to a json file used for the update notification system</td><td>string/url</td><td><a href="https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json">https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json</a></td></tr><tr><td>events</td><td>Whether the plugin has events or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>commands</td><td>whether the plugin has slash commands or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>has_index</td><td>Whether the plugin can start on bot startup or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>has_intents</td><td>Whether the plugin adds custom intents</td><td>boolean (true/false)</td><td>false</td></tr><tr><td>main_file</td><td>The file the bot should use to find the startup function</td><td>string</td><td>index.js</td></tr><tr><td>list_in_plugins_command</td><td>Whether to display the plugin in the plugins command</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>requirements</td><td>The various requirements for the plugin. Currently the requirements settings are ONLY used for defining the plugins support Bit versions.</td><td>array</td><td>See Below</td></tr></tbody></table>

Example

```json
{
    "name": "Bit Core",
    "id": "bit-core",
    "developer": "Lockyz Media",
    "version": "2025.1.0",
    "support": "https://github.com/Lockyz-Media/bit/issues",
    "update_url": "https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json",
    "events": true,
    "commands": true,
    "has_index": true,
    "has_intents": false,
    "main_file": "index.js",
    "list_in_plugins_command": true,
    "requirements": {
        "bit": {
            "version": "2025.1.0",
            "level": 0
        }
    }
}
```

## Plugin IDs

Plugins use an ID system to make it easier for developers wanting to use your code, to do their code. Plugin IDs will be used for plugin requirements, querying plugins (ex. loading the plugin list), and other bot functions. All plugins must use unique ID's when loaded into the bot, otherwise the bot will disable the plugin loaded second (We will only enforce plugin ID's in our certified plugins program. Plugins with the ID of bit-core will cause the bot to crash).

Plugin ID requirements are:

MUST be in Kebab Case (ex. kebab-case)!

CANNOT include numbers!

CANNOT include symbols bar the dash (-) that replaces the space!

CANNOT include a space - this WILL break the bot, use a dash (-) instead!

CANNOT use the name `bit-core`

CANNOT use offensive language.

## Plugin Requirements

The bot will cross reference the plugin requirements array within the plugin.json file with the bots plugin list.

Plugins are required to have bit as a level 0 requirement as the requirements system has replaced the old bitVersion setting.

For Example

```json
"requirements": {
    "bit": {
        "version": "2025.1.0",
        "level": 0,
    },
    "jupiter": {
        "version": "0.2.0",
        "level": 1,
    },
    "dismon": {
        "version": "2.0.0",
        "level": 2,
    },
    "logging": {
        "version": "2.0.0",
        "level": 3,
    }
}
```

The above code will

1. Check if the current bit version is 2025.1.0
2. Fail to start if bit is not installed or the version is not 2025.1.0
3. Check if the Jupiter plugin is installed
4. Fail to start if the plugin isn't loaded, but will output to the console of the version is not the same.
5. Check if the bot has the Dismon Plugin 2.0.0
6. If Dismon is not found, the bot will instead output to the console and parts of this plugin will be disabled. If the version does not match, the bot will only output to the console.
7. Check if the logging plugin is installed
8. Fail to start if it is.

There are 4 requirement levels

Level 0, requires the external plugin at that specific version be loaded for your plugin to work.

Level 1, requires the external plugin to be loaded regardless of said external plugins version

Level 2, is basically a soft requirement, the external plugin is not "required" but part of the your plugin will not work without it. (You should include a check for this in your code)

Level 3, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.

You can find more information about the requirements system in [Plugin Requirements](/docs/dev/create-plugins/plugin-requirements)


# update.json

The file required for Bit: Cores plugin update system to work

The bot will check the update json for the latest version of the plugin, where to download it from and what version of Bit: Core it's for.

<table><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>download_link</td><td>A link to the plugins latest version, is sent to the bots console when outdated</td><td>string/url</td><td>true</td></tr><tr><td>bit_version</td><td>Each bit version can have it's own "latest" version. If a specified version is not found the bot will tell the user to update their Bit version.</td><td>array</td><td>true</td></tr></tbody></table>

Update JSON Example

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2025.1": "2.0.0"
    }
}
```


# Updating to Bit 2025.2

## Plugin Count and Plugin List functions have been moved!

With bit now exporting the pluginLoader.js file and the functions within, we've officially deprecated the old `plugin_count()` and `plugin_list()` functions from Bit: Core.

Replacement Example

```javascript
// Old Code Example
const core = require('bit/core')

const totalPlugins = core.plugin_count()
const pluginsList = core.plugin_list()

// New Code Example
const plugins = require('bit/plugins')

const totalPlugins = plugins.count()
const pluginsList = plugins.list()
```

## New Plugin Functions

This version of Bit adds a few extra functions added to make interacting between plugins easier.

For example, the new `plugins.is_active(id)` function makes it MUCH easier to know if a plugin is installed and active.

You can find more information on these new functions in [bit/plugins](/docs/dev/create-plugins/functions/plugins)

## Global "database" folder renamed to "data"

We've removed the "database" folder and replaced it with a standard "data" folder, this should be better representative of what the folder is actually for.

## Experimental: Global Exports

{% hint style="danger" %}
WARNING: This feature is EXPERIMENTAL.

Please exercise caution when using this feature!
{% endhint %}

Within bits package.json file, we've now defined a global export, under bit/plugin/\*. This means that any exported function within your plugins index.js (HAS to be named that way) can be accessed by importing "bit/plugin/PLUGINID". This should HOPEFULLY make inter-plugin compatibility MUCH better.

Example

```javascript
const xp = require('bit/plugin/bit-xp');

// Gives my user account, 10 XP and triggers the level up message if that happens
// Coming soon to a Bit: XP near YOU
xp.add_xp(835394949612175380, 10, true)
```

## Experimental: Definable Intents

{% hint style="danger" %}
WARNING: This feature is EXPERIMENTAL.

Please exercise caution when using this feature!
{% endhint %}

We've added the ability for plugins to force the bot to import required intents, before the bot defines the client. This feature should ONLY be used to define intents as it runs BEFORE bit defines the Discord Client, and other plugins.

For now, this feature is run through a second function inside your index.js file called define\_intents()

Example

```javascript
const core = require('bit/core');
const { GatewayIntentBits } = require('discord.js');

module.exports = {
    define_intents: function define_intents() {
        // Adds the MessageContent intent
        // I recommend against adding this intent unless ABSOLUTELY required
        // This intent allows the bot to see Message Content and is ABSOLUTELY dangerous
        core.add_intent(GatewayIntentBits.MessageContent)
    }
}
```

You'll also need to define some settings within your plugin.json file for this feature to work

Example

```json
{
    // ... Other Stuff
    // The below variables NEED to be set to true, and main_file MUST be accessible from within your plugin
    "has_index": true,
    "has_intents": true,
    "main_file": "index.js",
    // ... The rest of the file   
}
```

## Experimental: Definable Node Modules

{% hint style="danger" %}
WARNING: This feature is EXPERIMENTAL.

Please exercise caution when using this feature!
{% endhint %}

We've added the ability to install node modules. This will allow your plugin to install node modules from NPM that your plugin needs.

Example

```javascript
const core = require("bit/core");

module.exports = {
    start_function: function start_function() {
        // This code will install v4.0.4 of the DismonDB module
        // (You should check that out BTW, I hear a really good developer made it :])
        // https://www.npmjs.com/package/dismondb
        core.install_module('dismondb@4.0.4')
    }
}
```


# Updating to Bit 2025.1

## plugin.json changes

With the release of the requirements system, we've updated how to define requirements.

The requirement level is now an integer value and the key for levels has changed, you can see it below

Level 0, requires the external plugin at that specific version be loaded for your plugin to work.

Level 1, requires the external plugin to be loaded regardless of said external plugins version

Level 2, is basically a soft requirement, the external plugin is not "required" but part of your plugin will not work without it. (You should include a check for this in your code, however a feature will be added to Bit Core to aid in this in the future.)

Level 3, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.

While it may never come up, please make sure that custom features check the plugins database for if your plugin is disabled.

## Configs Folder

Configs can now be added to a global configs folder in the bots root directory.

Part of Bit Plugin Certification now requires that ALL plugin configs are added to this configs folder, this is to allow the user an easy to access location that's the same for ALL plugins. Your plugins configs should also be under a folder with your plugins ID. (For example bit-cores config file is under the bit-core folder). It is HIGHLY recommended that your plugin auto-generates all configs with default values in order to allow for a user-friendly operation. A future version of Bit will include the ability to auto-generate these configs whenever the bot starts up, this wasn't included in this version to allow for the update to release sooner rather than later.

## Databases Folder

Bit now includes a databases folder, this is to allow plugin authors a dedicated place for all the files your plugin generates. This should also be used for any other files your plugin needs in order to operate, a system to automatically move these files from a folder in your plugin will come in the future.

## Banned Users Database

Bit now includes a banned-users database, while simplistic in nature, this database is used within the bots interactionCreate event to disable access to bot commands, we recommend using this database to disable access to features within your plugin to banned users. This database MUST be a manual entry to prevent issues, this means you MUST NOT create a function to add users to this database.

## Bit Core Functions

Bit Core now includes various functions for use with your plugins, in the future this will be used for querying configs and bits default databases.

These functions can be found in the [bit/core](/docs/dev/create-plugins/functions/bit-core)page.&#x20;

One of these functions includes a logging function, we highly recommend using that function for logs over the standard console.log (or console.error) to allow for consistent logs across the board.

You can find more information on the logging function in [.log(type, "Plugin Name", force\_console, "Log")](/docs/dev/create-plugins/functions/bit-core/logs)


# Updating to Bit 2024.2

Bit 2024.2 changes very little, however we HIGHLY recommend following this guide to update.

#### Use new context and installation types. <a href="#use-new-context-and-installation-types" id="use-new-context-and-installation-types"></a>

Discord.JS officially released the ability to create user-installable apps as of discord.js 14.16.0, as such we've deprecated our old method for this and have switched to the official method.

**Code to remove from commands**

Copy

```
    // Sets if the command can be used with the bot as a user-installed app or a guild-installed app.
    integration_types: {
        user: true,
        guild: true,
    },
    // Sets if the command can be used in a guild-channel, the bots DMs or a private channel (only works IF the command is user-installable, group DMs and regular user DMs)
    context_types: {
		guildChannel: true,
		botDM: true,
		privateChannel: true,
	},
```

**Code to add to commands**

(Should be in the line JUST before async execute(interaction) and include the comma)

Copy

```
.setIntegrationTypes(0,1)
.setContexts(0,1,2)
```

#### Main config moved <a href="#main-config-moved" id="main-config-moved"></a>

Bits main config file has been moved to /configs/bit/ please be sure to update your imports if you use the values in Bits default config file.


# Updating to Bit 2024.1

Bit 2024.1 changes a LOT of things, please follow this guide to get your plugins updated!

As Bit 2024.1 is a major release, previous versions of the bot cannot be supported!

## plugin.json changes

All settings now use snake-case for their names!

The events and commands values have been changed to use booleans instead of strings (this is to prevent issues) and plugin versions are now required to use semantic versioning (major.minor.patch)

The bitVersion field is being removed as it will now be part of the requirements settings

| Option                     | Value Type | Default Value                                                           | Status                                                                  |
| -------------------------- | ---------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| name                       | string     | Bit Core                                                                |                                                                         |
| id                         | string     | bit-core                                                                | NEW                                                                     |
| developer                  | string     | Lockyz Media                                                            |                                                                         |
| version                    | string     | 2024.1.0                                                                | <p>CHANGED<br>- Now requires semantic versioning</p>                    |
| support                    | string     | <https://github.com/Lockyz-Media/bit/issues>                            |                                                                         |
| update\_url                | string     | <https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json> | <p>CHANGED<br>- Option ID is now in snake case</p>                      |
| events                     | boolean    | false                                                                   | <p>CHANGED<br>- Now a boolean</p>                                       |
| commands                   | boolean    | true                                                                    | <p>CHANGED<br>- Now a boolean</p>                                       |
| hasIndex                   | boolean    | true                                                                    | NEW                                                                     |
| mainFile                   | string     | index.js                                                                | NEW                                                                     |
| list\_in\_plugins\_command | boolean    | true                                                                    | NEW                                                                     |
| requirements               | array      | See Below                                                               | <p>NEW<br><br>Requitements are not yet used bar the Bit requirement</p> |

Example plugin.json

```json
{
    "name": "Bit Core",
    "id": "bit-core",
    "developer": "Lockyz Media",
    "version": "2024.1.0",
    "support": "https://github.com/Lockyz-Media/bit/issues",
    "update_url": "https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json",
    "events": true,
    "commands": true,
    "hasIndex": true,
    "mainFile": "index.js",
    "list_in_plugins_command": true,
    "requirements": {
        "bit": {
            "version": "2024.1.0",
            "level": "1"
        }
    }
}
```

## How will plugin requirements work

{% hint style="danger" %}
Plugins Requirements are being saved for another update. Please keep the only requirement as Bit.
{% endhint %}

The bot will cross reference the plugin requirements array within the plugin.json file with the bots plugin list (Currently not available). Each requirement will be listed as plugin-id:version within the Plugin List.

Plugins are required to have bit as a level 1 requirement as the requirements system is replacing the old bitVersion setting.

For Example

```json
"requirements": {
    "bit": {
        "version": "2024.1.0",
        "level": "1",
    },
    "jupiter": {
        "version": "0.2.0",
        "level": "2",
    },
    "dismon": {
        "version": "2.0.0",
        "level": "3",
    },
    "logging": {
        "version": "2.0.0",
        "level": "4",
    }
}
```

The above code will

1. Check if the current bit version is 2024.1.0
2. Fail to start if bit is not installed or the version is not 2024.1.0
3. Check if the Jupiter plugin is installed
4. Fail to start if the plugin isn't loaded, but will output to the console of the version is not the same.
5. Check if the bot has the Dismon Plugin 2.0.0
6. If Dismon is not found, the bot will instead output to the console and parts of this plugin will be disabled. If the version does not match, the bot will only output to the console.
7. Check if the logging plugin is installed
8. Fail to start if it is.

There are 3 requirement levels

Level 1, requires the external plugin at that specific version be loaded for your plugin to work.

Level 2, requires the external plugin to be loaded regardless of said external plugins version

Level 3, is basically a soft requirement, the external plugin is not "required" but part of the your plugin will not work without it. (You should include a check for this in your code)

Level 4, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.

## Plugin ID's

Plugins now use an ID system to make it easier for developers wanting to use your code, to do their code. Plugin IDs will be used for plugin requirements, querying plugins (ex. loading the plugin list), and other bot functions. All plugins must use unique ID's when loaded into the bot, otherwise the bot will disable the plugin loaded second (We will only enforce plugin ID's in our certified plugins program. Plugins with the ID of bit-core will cause the bot to crash).

Plugin ID requirements are:

MUST be in Kebab Case (ex. kebab-case)!

CANNOT include numbers!

CANNOT include symbols bar the dash (-) that replaces the space!

CANNOT include a space - this WILL break the bot, use a dash (-) instead!

CANNOT use the name `bit-core`

CANNOT use offensive language.

## update.json changes

All options are now in snake case, however plugins that are made for older versions of Bit should use the legacy values. The "latest" field has been removed and all the various bit versions are under an array, if your plugin is available for legacy versions of Bit, please use the legacy values as well (We're aware this may be annoying for some, as Bit matures and we start to create a consistent code style, various things will change)

Update JSON Example

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.1": "2.0.0"
    }
}
```

Update JSON Example with Legacy Options - As the "developer" option was never actually used, it should NOT be used when legacy versions are available.

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.1": "2.0.0",
    },
    "downloadLink": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "latest": "2.0.0",
    "5.1": "1.0.0",
    "5.0": "1.0.0"
}
```

## New command options

Commands have been updated to include some new custom values. These new custom values allow for creating user-installable apps!

**Cooldown -** The cooldown setting sets an optional cooldown (defaults to 3 seconds) on bot commands. This setting is in seconds.

**integration\_types** - This array allows for setting when different commands CAN show up in the client, for example setting integration\_types.user to true allows the command to be seen/used when the bot is used as a user-installed app, and integration\_types.guild allows the command to be seen/used when the bot is used as a guild-installed app (the way bots have always been installed). Both options can be true.

**context\_types** - This array allows for setting where a command can show up in the client. For example, context\_types.guild\_channel allows the command to be seen in guild channels, context\_types.bot\_dm allows the command to be seen in the bots DM's and context\_types.private\_channel allows the command to be used in the users private DM's (with other people) and group DMs. However context\_types.private\_channel only works if the integration\_types.user is on.

| Option                          | Value Type | Default Value |
| ------------------------------- | ---------- | ------------- |
| cooldown                        | integer    | 5             |
| integration\_types.user         | boolean    | true          |
| integration\_types.guild        | boolean    | true          |
| context\_types.guild\_channel   | boolean    | true          |
| context\_types.bot\_dm          | boolean    | true          |
| context\_types.private\_channel | boolean    | true          |

Format

```javascript
// Cooldowns can be any number upto the 32-bit integer limit. This number is in seconds!
cooldowns: 5,

integration_types: {
    user: true,
    guild: true,
},

context_types: {
    guild_channel: true,
    bot_dm: true,
    private_channel: true,
},
```

## Run code on bot startup

Bit now allows plugins to run code on startup!

This means that within your plugin.json file you can tell the bot to run the code within the mainFile file!

The starting function MUST be called `startFunction` the casing of the function name MAY change in the future to increase consistency within Bit.

Example - index.js from Bit: Core

```javascript
module.exports = {
    startFunction: function startFunction() {
        console.log("Bit: Core Successfully Loaded!")
    }
};
```


# Bienvenido

{% hint style="danger" %}
La documentación en español de Bit actualmente no está terminada y está traducida automáticamente.
{% endhint %}

Bienvenido a la documentación de Bits en español.

Tenga en cuenta que este documento no está terminado y está traducido automáticamente.

Si hay algún error de traducción, envíenos un correo electrónico a <lockyzmedia@gmail.com>


# Crear complementos

Empiece a crear complementos para Bit

## Empezando

1. Descargue nuestro complemento de ejemplo
2. Personalícelo a su gusto
3. Envíenos un correo electrónico a <lockyzmedia@gmail.com> para certificar su complemento

Estas guías asumen que ya conoces los conceptos básicos de node.js y/o cómo crear un bot de Discord usando discord.js


# Comandos

{% hint style="danger" %}
¡Esta guía no está terminada! Te recomendamos que sigas la guía de comandos de discord.js que se encuentra aquí <https://discordjs.guide/creating-your-bot/slash-commands.html#individual-command-files>
{% endhint %}

## Ejemplo de comando

```javascript
const { EmbedBuilder, version: discordVersion, SlashCommandBuilder } = require('discord.js')
const moment = require('moment');
require('moment-duration-format');
const language = require('../../../config.json')

module.exports = {
    cooldown: 5,
    data: new SlashCommandBuilder()
        .setName('info')
        .setNameLocalizations({
            de: 'info',
            fr: 'info',
        })
		.setDescription('Get advanced information about the bot.')
        .setDescriptionLocalizations({
            de: 'Erhalten Sie erweiterte Informationen über den Bot.',
            fr: 'Obtenez des informations avancées sur le bot.',
        })
        .setIntegrationTypes(0,1)
        .setContexts(0,1,2),
	async execute(interaction) {
        const client = interaction.client
        var lan = language;
        const locale = require('../../../locale/'+lan+'.json')

        const botUptime = moment.duration(client.uptime).format(' D [days], H [hrs], m [mins], s [secs]');
        const memUsage = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2);
        const guildSize = client.guilds.cache.size.toString();
        const userSize = client.users.cache.size.toString();
        
        var d = new Date();
        var n = d.getFullYear();
        const embed = new EmbedBuilder()
            .setTitle(locale.bot.name)
            .setDescription(locale.bot.description)
            .addFields(
                { name: locale.misc.support, value: "https://discord.gg/NgpN3YYbMM", inline: true },
                { name: locale.misc.developer, value: "Robin Painter", inline: true },
                { name: locale.misc.guilds, value: guildSize, inline: true },
                { name: locale.misc.users, value: userSize, inline: true },
                { name: locale.misc.uptime, value: botUptime, inline: true },
                { name: locale.misc.memory, value: `${Math.round(memUsage)} MB`, inline: true },
                { name: locale.misc.discordJS, value: `v${discordVersion}`, inline: true },
                { name: locale.misc.node, value: `${process.version}`, inline: true },
                { name: locale.misc.version, value: "v5.2.0", inline: true },
                { name: locale.misc.bugTracker, value: "https://tracker.lockyzdev.net/set_project.php?project_id=5", inline: true },
            )
            .setFooter({ text: locale.misc.copyrightText.replace('{year}', n)});
        interaction.reply({ embeds: [embed] })
	}
};
```


# Eventos

{% hint style="danger" %}
¡Esta guía no está terminada! Te recomendamos que sigas la guía de discord.js mientras tanto <https://discordjs.guide/creating-your-bot/event-handling.html>
{% endhint %}


# Requisitos del complemento

Si su complemento utiliza funciones de otro complemento, puede asegurarse de advertir al usuario haciendo uso del sistema de requisitos de complementos de Bits.

## Configuración

Dentro del archivo plugin.json de sus complementos puede encontrar un campo para definir los requisitos de sus complementos; estos requisitos se enumerarán cuando el complemento se cargue en bit y cuando ejecute el comando plugins.

```json
{
    "requirements": {
        "bit": {
            "version": "2025.1.0",
            "level": 0
        },
        "jupiter": {
            "version": "2025.1.0",
            "level": 2
    }
}
```

Un ejemplo de un complemento que requiere Bit y Jupiter

## Niveles de requisitos

Hay 4 niveles diferentes de requisitos de Bit, que se pueden usar para evitar que el complemento se cargue si el complemento y la versión específica no están presentes, y se pueden usar para evitar que el complemento se cargue si el complemento ESTÁ presente.

Nivel 0, requiere que el complemento externo en esa versión específica se cargue para que su complemento funcione. Nivel 1, requiere que el complemento externo se cargue independientemente de la versión de dicho complemento externo. Nivel 2, es básicamente un requisito flexible, el complemento externo no es "obligatorio", pero parte de su complemento no funcionará sin él. (Debe incluir una verificación para esto en su código, sin embargo, se agregará una función a Bit Core para ayudar en esto en el futuro). Nivel 3, el complemento NO se iniciará si también se carga un complemento de este nivel. Esto se puede usar para complementos que no sean compatibles con el suyo.


# Funciones


# bit/plugins

Como parte de Bit 2025.2 agregamos un nuevo conjunto de funciones para interactuar con el sistema de complementos de Bits.

Estas funciones se pueden importar con el siguiente código en la parte superior de su código

```javascript
const plugins =  require("bit/plugins");
```

Hay algunas funciones diferentes que puedes ejecutar con esta importación...

### .is\_active(id, versión)

La función is\_active se puede utilizar para detectar si un complemento está instalado y si coincide con una versión específica. Esta función se debe utilizar junto con el sistema de requisitos de software de bits para bloquear partes de su complemento a los usuarios que pueden no tener todos los complementos necesarios.

El parámetro de versión es opcional y se puede omitir.

```javascript
plugins.is_active(id, versión)
```

Ejemplo con Bit: Core 2025.2.0 instalado

```javascript
const reqMet = plugins.is_active('bit-core', '2025.2.0');

console.log(reqMet)

// Output if everything matches
/*
{
    "installed": true,
    "activated": true,
    "match_version": true
}
*/

// Output if Bit: Core is not installed
/*
{
    "installed": false,
    "activated": null,
    "match_version": null
}
*/

// Output if Bit: Core is installed but not on the right version.
/*
{
    "installed": true,
    "activated": true,
    "match_version": false
}
*/

// Output if Bit: COre is installed but disabled
/*
{
    "installed": true,
    "activated": false,
    "match_version": null
}
*/
```

### .find(id)

plugins.find(id) se utiliza para buscar un complemento específico y su información.

Si no se puede encontrar el complemento en la base de datos de complementos, devolverá un código de estado 404.

Esta función devolverá una matriz con la información del complemento y/o el estado de la búsqueda.

```javascript
plugins.find(id)
```

Ejemplo de uso

```javascript
const plugins = require('bit/plugins');

const pluginInfo = plugins.find('bit-core')

if(!pluginInfo.status.code === 404) {
    console.log(`Plugin with an id of 'bit-core' cannot be found`)
} else {
    console.log(`Plugin with an id of 'bit-core' was found!`)
    console.log(`Plugin Name: ${pluginInfo.plugin.name}`)
    console.log(`Plugin ID: ${pluginInfo.plugin.id}`)
    console.log(`Plugin Version: ${pluginInfo.plugin.version}`)
    console.log(`Plugin Has Index?: ${pluginInfo.plugin.has_index}`)
    console.log(`Plugin Disabled: ${pluginInfo.plugin.disabled}`)
    console.log(`Plugin Requirements: ${pluginInfo.plugin.requirements}`)
}

// Output if bit-core is found
/*
Plugin with an id of 'bit-core' was found!
Plugin Name: Bit: COre
Plugin ID: bit-core
Plugin Version: 2025.2.0
Plugin Has Index?: true
Plugin Disabled: false
Plugin Requirements: {
    "bit": {
        "version": "2025.2.0",
        "level": 0
    }
}
*/

// Output if bit-core is not found
/*
Plugin with an id of 'bit-core' cannot be found
*/
```

### .list()

Muestra una lista de todos los complementos instalados

```javascript
plugins.list()
```

{% hint style="danger" %}
INCONCLUSO
{% endhint %}

### .count()

Cuenta todos los complementos instalados y genera el número.

```javascript
plugins.count()
```

Ejemplo

```javascript
const plugins = require('bit/plugins');

const count = plugins.count()

console.log(count)

// Output
/* 
0
*/
```


# bit/core

## .log(tipo, "Nombre del complemento", forceconsole, "Mensaje")

Envía un registro en el formato "estándar" para Bit.

{% content-ref url="/pages/900pcqEuiaOqqnk7adGU" %}
[.logs](/docs/dev-es/crear-complementos/funciones/bit-core/.logs)
{% endcontent-ref %}

### .find\_emoji()

Devuelve un emoji en un formato que Discord puede leer.


# .logs

Bit utiliza un sistema de registro personalizado. Para utilizar el nuevo sistema de registro de Bit, simplemente debe importar bit/core y luego seguir la estructura de funciones.

```javascript
const core = require('bit/core');

// Ejemplo de complemento de registro de errores como bit
core.log(2, "bit de salida", false, "Algo se rompió")
// ^ Ejemplo de bit de salida "[ERROR]: Algo se rompió"

// Ejemplo de complemento de registro de ADVERTENCIA como bit
core.log(1, "bit de salida", false, "Algo se rompió")
// ^ Ejemplo de bit de salida "[WARNING]: Algo se rompió"

// Ejemplo de complemento de registro de información como bit
core.log(0, "bit de salida", false, "Algo se rompió")
// ^ Ejemplo de bit de salida "[INFO]: Algo se rompió"
```

También puedes forzar que el registro aparezca en la consola de bots independientemente de la configuración de los usuarios.

```javascript
const core = require('bit/core');

// Force ERROR from Bit Example Plugin to appear in the bots console
core.log(2, "Bit Example", true, "Something Broke")
// ^ Will ALWAYS output "[ERROR] Bit Example: Something Broke"

// Don't Force ERROR from Bit Example Plugin to appear in the bots console
core.log(2, "Bit Example", false, "Something Broke")
// ^ Will only output "[ERROR] Bit Example: Something Broke" if the user has error logs turned on for the console
```


# Ejecutar función al iniciar el bot

Puedes ejecutar funciones programadas para ejecutarse cuando se inicia el bot.

Para permitir esto, deberás cumplir con algunos requisitos previos.


# Welcome

Bit is a completely customisable Discord Bot

Source Code: <https://github.com/Lockyz-Media/bit>

Created by Lockyz Media [https://lockyzmedia.com/](https://lockyzmedia.com)

## Updating to Bit 2025.1?

For the Bot [Updating](/docs/2025.1/updating)

For Plugin Developers [Updating to Bit 2025.1](/docs/2025.1/dev/create-plugins/updating-to-bit-2025.1)

## Wanting to make a plugin?

Simply follow our guide [Create Plugins](/docs/2025.1/dev/create-plugins)


# Updating

#### Bit 2024.2 to Bit 2025.1 <a href="#bit-2024.1-to-bit-2024.2" id="bit-2024.1-to-bit-2024.2"></a>

**Things to remember**

* Make sure ALL plugins are updated to Bit 2025.1
  * Bit 2025.1 has changed quite a LOT compared to Bit 2024.2
* Delete every single file and folder from Bit excluding the plugins folder (though remove the bit-core plugin). It's HIGHLY recommended to remake your config for this release.

**Updating config.json**

Bit 2025.1 splits up the config file. Please redownload Bits MAIN config file, and update the settings there. This should be located in the Bit folder NOT the config/bit-core folder (which is used for bits update system and can break the bot if touched)

**Update ALL plugins to their latest versions**

All plugins must be updated for use in Bit 2025.1

**Update your node modules and deploy commands**

Open the bot in the terminal of your choice and run the `npm i` command.

Once that is done run `node deploy.js` to deploy the bots commands.

**And you're done**

Aside from plugin-specific updates, you should now be fine to run Bit. Simply use the `node bit.js` command and you're all set!


# Commands

As part of the Bit Core plugin, Bit (without any other plugins) only has the following commands

| Command | Usage                | Description                               |
| ------- | -------------------- | ----------------------------------------- |
| Info    | /info                | Get advanced information about the bot    |
| Plugins | /plugins             | List all plugins available within the bot |
| Plugin  | /plugin {pluginName} | Lists information on a specific plugin    |


# FAQ

## Where can I get support?

We have a whole discord server for support which you can [find here](https://discord.gg/NgpN3YYbMM)

## Will this give me a virus?

Nope, unless you found the "source" code on a shady site that has inserted a virus.

## Can you add feature X?

You're always welcome to suggest features on our [Discord Server](https://discord.gg/NgpN3YYbMM). Or you can make a pull request on our [GitHub repo](https://github.com/Lockyz-Media/bit)


# Install Plugins

Follow the documentation listed on the plugins documentation page. Or follow the basic example below (some plugins will require installing specific node.js modules and will not work if these modules are not installed prior)

Simply unzip the plugins folder into the bit/plugins folder.

If a plugin adds a config, please follow the plugin authors instructions on using it. Some plugins do not use the configs folder yet.

You should then run the deploy script `deploy.js`


# Create Plugins

Get started making plugins for Bit

## Getting Started

1. Download our example plugin
2. Customise it to your hearts content
3. Email us at <lockyzmedia@gmail.com> to get your plugin certified

These guides assume you already know basic node.js and/or how to create a Discord bot using discord.js


# Commands

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for commands found here <https://discordjs.guide/creating-your-bot/slash-commands.html#individual-command-files>
{% endhint %}

### Command Example <a href="#command-example" id="command-example"></a>

```javascript
const { EmbedBuilder, version: discordVersion, SlashCommandBuilder } = require('discord.js')
const moment = require('moment');
require('moment-duration-format');
const language = require('../../../config.json')

module.exports = {
    cooldown: 5,
    data: new SlashCommandBuilder()
        .setName('info')
        .setNameLocalizations({
            de: 'info',
            fr: 'info',
        })
		.setDescription('Get advanced information about the bot.')
        .setDescriptionLocalizations({
            de: 'Erhalten Sie erweiterte Informationen über den Bot.',
            fr: 'Obtenez des informations avancées sur le bot.',
        })
        .setIntegrationTypes(0,1)
        .setContexts(0,1,2),
	async execute(interaction) {
        const client = interaction.client
        var lan = language;
        const locale = require('../../../locale/'+lan+'.json')

        const botUptime = moment.duration(client.uptime).format(' D [days], H [hrs], m [mins], s [secs]');
        const memUsage = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2);
        const guildSize = client.guilds.cache.size.toString();
        const userSize = client.users.cache.size.toString();
        
        var d = new Date();
        var n = d.getFullYear();
        const embed = new EmbedBuilder()
            .setTitle(locale.bot.name)
            .setDescription(locale.bot.description)
            .addFields(
                { name: locale.misc.support, value: "https://discord.gg/NgpN3YYbMM", inline: true },
                { name: locale.misc.developer, value: "Robin Painter", inline: true },
                { name: locale.misc.guilds, value: guildSize, inline: true },
                { name: locale.misc.users, value: userSize, inline: true },
                { name: locale.misc.uptime, value: botUptime, inline: true },
                { name: locale.misc.memory, value: `${Math.round(memUsage)} MB`, inline: true },
                { name: locale.misc.discordJS, value: `v${discordVersion}`, inline: true },
                { name: locale.misc.node, value: `${process.version}`, inline: true },
                { name: locale.misc.version, value: "v5.2.0", inline: true },
                { name: locale.misc.bugTracker, value: "https://tracker.lockyzdev.net/set_project.php?project_id=5", inline: true },
            )
            .setFooter({ text: locale.misc.copyrightText.replace('{year}', n)});
        interaction.reply({ embeds: [embed] })
	}
};
```


# Events

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for that in the meantime <https://discordjs.guide/creating-your-bot/event-handling.html>
{% endhint %}


# Plugin Requirements

If your plugin uses functions from another plugin, you can make sure to warn the user by making use of Bits plugin requirements system!

## Setup

Within your plugins plugin.json file you can find a field for defining your plugins requirements, these requirements will be listed when the plugin loads into bit, and when you run the plugins command.

```json
{
    "requirements": {
        "bit": {
            "version": "2025.1.0",
            "level": 0
        },
        "jupiter": {
            "version": "2025.1.0",
            "level": 2
    }
}
```

An example of a plugin requiring Bit and Jupiter

## Requirement Levels

There are 4 different levels of Bit requirements, these can be used to stop the plugin from loading if the plugin and specific version is not present, and can be used to stop the plugin from loading if the plugin IS present.

Level 0, requires the external plugin at that specific version be loaded for your plugin to work.

Level 1, requires the external plugin to be loaded regardless of said external plugins version

Level 2, is basically a soft requirement, the external plugin is not "required" but part of your plugin will not work without it. (You should include a check for this in your code, however a feature will be added to Bit Core to aid in this in the future.)

Level 3, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.


# Bit Core Functions

Log - Sends a log in the "standard" format for Bit.

{% content-ref url="/pages/19INfTilzT64osCuPVks" %}
[Logs](/docs/2025.1/dev/create-plugins/bit-core-functions/logs)
{% endcontent-ref %}

Find Emoji - find\_emoji - Returns an emoji in a format Discord can read.

Plugins Count - plugins\_count - Returns the number of plugins installed

Plugins List - plugins\_list - Returns an array with all of the plugins currently installed


# Logs

Bit employs a custom logging system. To use bits new logging system you simply have to import bit/core and then follow the function structure.

```javascript
const core = require('bit/core');

// Log ERROR as Bit Example plugin
core.log(2, "Bit Example", false, "Something Broke")
// ^ Will output "[ERROR] Bit Example: Something Broke"

// Log WARNING as Bit Example Plugin
core.log(1, "Bit Example", false, "Something Broke")
// ^ Will output "[WARNING] Bit Example: Something Broke"

// Log INFO as Bit Example Plugin
core.log(0, "Bit Example", false, "Something Broke")
// ^ Will output "[INFO] Bit Example: Something Broke"
```

You can also force the log to appear in the bots console regardless of the users settings

```javascript
const core = require('bit/core');

// Force ERROR from Bit Example Plugin to appear in the bots console
core.log(2, "Bit Example", true, "Something Broke")
// ^ Will ALWAYS output "[ERROR] Bit Example: Something Broke"

// Don't Force ERROR from Bit Example Plugin to appear in the bots console
core.log(2, "Bit Example", false, "Something Broke")
// ^ Will only output "[ERROR] Bit Example: Something Broke" if the user has error logs turned on for the console
```


# 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

```javascript
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!")
    }
}
```


# plugin.json

All the plugin.json options for a Bit Core Plugin and what they're used for

<table data-full-width="true"><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th>Default Value</th></tr></thead><tbody><tr><td>name</td><td>The plugins name</td><td>string</td><td>Bit Core</td></tr><tr><td>id</td><td>The plugins ID</td><td>string (requirements below)</td><td>bit-core</td></tr><tr><td>developer</td><td>The plugins developer</td><td>string</td><td>Lockyz Media</td></tr><tr><td>version</td><td>What version the plugin is</td><td>string</td><td>2024.1.0</td></tr><tr><td>support</td><td>A place to go to get support</td><td>string</td><td><a href="https://github.com/Lockyz-Media/bit/issues">https://github.com/Lockyz-Media/bit/issues</a></td></tr><tr><td>update_url</td><td>A url pointing to a json file used for the update notification system</td><td>string/url</td><td><a href="https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json">https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json</a></td></tr><tr><td>events</td><td>Whether the plugin has events or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>commands</td><td>whether the plugin has slash commands or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>has_index</td><td>Whether the plugin can start on bot startup or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>main_file</td><td>The file the bot should use to find the startup function</td><td>string</td><td>index.js</td></tr><tr><td>list_in_plugins_command</td><td>Whether to display the plugin in the plugins command</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>requirements</td><td>The various requirements for the plugin. Currently the requirements settings are ONLY used for defining the plugins support Bit versions.</td><td>array</td><td>See Below</td></tr></tbody></table>

Example

```json
{
    "name": "Bit Core",
    "id": "bit-core",
    "developer": "Lockyz Media",
    "version": "2025.1.0",
    "support": "https://github.com/Lockyz-Media/bit/issues",
    "update_url": "https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json",
    "events": true,
    "commands": true,
    "has_index": true,
    "main_file": "index.js",
    "list_in_plugins_command": true,
    "requirements": {
        "bit": {
            "version": "2025.1.0",
            "level": 0
        }
    }
}
```

## Plugin IDs

Plugins use an ID system to make it easier for developers wanting to use your code, to do their code. Plugin IDs will be used for plugin requirements, querying plugins (ex. loading the plugin list), and other bot functions. All plugins must use unique ID's when loaded into the bot, otherwise the bot will disable the plugin loaded second (We will only enforce plugin ID's in our certified plugins program. Plugins with the ID of bit-core will cause the bot to crash).

Plugin ID requirements are:

MUST be in Kebab Case (ex. kebab-case)!

CANNOT include numbers!

CANNOT include symbols bar the dash (-) that replaces the space!

CANNOT include a space - this WILL break the bot, use a dash (-) instead!

CANNOT use the name `bit-core`

CANNOT use offensive language.

## Plugin Requirements

The bot will cross reference the plugin requirements array within the plugin.json file with the bots plugin list.

Plugins are required to have bit as a level 0 requirement as the requirements system has replaced the old bitVersion setting.

For Example

```json
"requirements": {
    "bit": {
        "version": "2025.1.0",
        "level": 0,
    },
    "jupiter": {
        "version": "0.2.0",
        "level": 1,
    },
    "dismon": {
        "version": "2.0.0",
        "level": 2,
    },
    "logging": {
        "version": "2.0.0",
        "level": 3,
    }
}
```

The above code will

1. Check if the current bit version is 2025.1.0
2. Fail to start if bit is not installed or the version is not 2025.1.0
3. Check if the Jupiter plugin is installed
4. Fail to start if the plugin isn't loaded, but will output to the console of the version is not the same.
5. Check if the bot has the Dismon Plugin 2.0.0
6. If Dismon is not found, the bot will instead output to the console and parts of this plugin will be disabled. If the version does not match, the bot will only output to the console.
7. Check if the logging plugin is installed
8. Fail to start if it is.

There are 4 requirement levels

Level 0, requires the external plugin at that specific version be loaded for your plugin to work.

Level 1, requires the external plugin to be loaded regardless of said external plugins version

Level 2, is basically a soft requirement, the external plugin is not "required" but part of the your plugin will not work without it. (You should include a check for this in your code)

Level 3, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.

You can find more information about the requirements system in [Broken mention](broken://pages/LuTLZL4y5vsDRghDVwLs)


# update.json

The file required for Bit: Cores plugin update system to work

The bot will check the update json for the latest version of the plugin, where to download it from and what version of Bit: Core it's for.

<table><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>download_link</td><td>A link to the plugins latest version, is sent to the bots console when outdated</td><td>string/url</td><td>true</td></tr><tr><td>bit_version</td><td>Each bit version can have it's own "latest" version. If a specified version is not found the bot will tell the user to update their Bit version.</td><td>array</td><td>true</td></tr></tbody></table>

Update JSON Example

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2025.1": "2.0.0"
    }
}
```


# Updating to Bit 2025.1

## plugin.json changes

With the release of the requirements system, we've updated how to define requirements.

The requirement level is now an integer value and the key for levels has changed, you can see it below

Level 0, requires the external plugin at that specific version be loaded for your plugin to work.

Level 1, requires the external plugin to be loaded regardless of said external plugins version

Level 2, is basically a soft requirement, the external plugin is not "required" but part of your plugin will not work without it. (You should include a check for this in your code, however a feature will be added to Bit Core to aid in this in the future.)

Level 3, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.

While it may never come up, please make sure that custom features check the plugins database for if your plugin is disabled.

## Configs Folder

Configs can now be added to a global configs folder in the bots root directory.

Part of Bit Plugin Certification now requires that ALL plugin configs are added to this configs folder, this is to allow the user an easy to access location that's the same for ALL plugins. Your plugins configs should also be under a folder with your plugins ID. (For example bit-cores config file is under the bit-core folder). It is HIGHLY recommended that your plugin auto-generates all configs with default values in order to allow for a user-friendly operation. A future version of Bit will include the ability to auto-generate these configs whenever the bot starts up, this wasn't included in this version to allow for the update to release sooner rather than later.

## Databases Folder

Bit now includes a databases folder, this is to allow plugin authors a dedicated place for all the files your plugin generates. This should also be used for any other files your plugin needs in order to operate, a system to automatically move these files from a folder in your plugin will come in the future.

## Banned Users Database

Bit now includes a banned-users database, while simplistic in nature, this database is used within the bots interactionCreate event to disable access to bot commands, we recommend using this database to disable access to features within your plugin to banned users. This database MUST be a manual entry to prevent issues, this means you MUST NOT create a function to add users to this database.

## Bit Core Functions

Bit Core now includes various functions for use with your plugins, in the future this will be used for querying configs and bits default databases.

These functions can be found in the [Broken mention](broken://pages/R1GIlkgKYDxQ9Jx8kQzs)page.

One of these functions includes a logging function, we highly recommend using that function for logs over the standard console.log (or console.error) to allow for consistent logs across the board.

You can find more information on the logging function in [Broken mention](broken://pages/CkZlbAshMxuYniAZBzzh)


# Updating to Bit 2024.2

Bit 2024.2 changes very little, however we HIGHLY recommend following this guide to update.

#### Use new context and installation types. <a href="#use-new-context-and-installation-types" id="use-new-context-and-installation-types"></a>

Discord.JS officially released the ability to create user-installable apps as of discord.js 14.16.0, as such we've deprecated our old method for this and have switched to the official method.

**Code to remove from commands**

Copy

```
    // Sets if the command can be used with the bot as a user-installed app or a guild-installed app.
    integration_types: {
        user: true,
        guild: true,
    },
    // Sets if the command can be used in a guild-channel, the bots DMs or a private channel (only works IF the command is user-installable, group DMs and regular user DMs)
    context_types: {
		guildChannel: true,
		botDM: true,
		privateChannel: true,
	},
```

**Code to add to commands**

(Should be in the line JUST before async execute(interaction) and include the comma)

Copy

```
.setIntegrationTypes(0,1)
.setContexts(0,1,2)
```

#### Main config moved <a href="#main-config-moved" id="main-config-moved"></a>

Bits main config file has been moved to /configs/bit/ please be sure to update your imports if you use the values in Bits default config file.


# Updating to Bit 2024.1

Bit 2024.1 changes a LOT of things, please follow this guide to get your plugins updated!

As Bit 2024.1 is a major release, previous versions of the bot cannot be supported!

## plugin.json changes

All settings now use snake-case for their names!

The events and commands values have been changed to use booleans instead of strings (this is to prevent issues) and plugin versions are now required to use semantic versioning (major.minor.patch)

The bitVersion field is being removed as it will now be part of the requirements settings

| Option                     | Value Type | Default Value                                                           | Status                                                                  |
| -------------------------- | ---------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| name                       | string     | Bit Core                                                                |                                                                         |
| id                         | string     | bit-core                                                                | NEW                                                                     |
| developer                  | string     | Lockyz Media                                                            |                                                                         |
| version                    | string     | 2024.1.0                                                                | <p>CHANGED<br>- Now requires semantic versioning</p>                    |
| support                    | string     | <https://github.com/Lockyz-Media/bit/issues>                            |                                                                         |
| update\_url                | string     | <https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json> | <p>CHANGED<br>- Option ID is now in snake case</p>                      |
| events                     | boolean    | false                                                                   | <p>CHANGED<br>- Now a boolean</p>                                       |
| commands                   | boolean    | true                                                                    | <p>CHANGED<br>- Now a boolean</p>                                       |
| hasIndex                   | boolean    | true                                                                    | NEW                                                                     |
| mainFile                   | string     | index.js                                                                | NEW                                                                     |
| list\_in\_plugins\_command | boolean    | true                                                                    | NEW                                                                     |
| requirements               | array      | See Below                                                               | <p>NEW<br><br>Requitements are not yet used bar the Bit requirement</p> |

Example plugin.json

```json
{
    "name": "Bit Core",
    "id": "bit-core",
    "developer": "Lockyz Media",
    "version": "2024.1.0",
    "support": "https://github.com/Lockyz-Media/bit/issues",
    "update_url": "https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json",
    "events": true,
    "commands": true,
    "hasIndex": true,
    "mainFile": "index.js",
    "list_in_plugins_command": true,
    "requirements": {
        "bit": {
            "version": "2024.1.0",
            "level": "1"
        }
    }
}
```

## How will plugin requirements work

{% hint style="danger" %}
Plugins Requirements are being saved for another update. Please keep the only requirement as Bit.
{% endhint %}

The bot will cross reference the plugin requirements array within the plugin.json file with the bots plugin list (Currently not available). Each requirement will be listed as plugin-id:version within the Plugin List.

Plugins are required to have bit as a level 1 requirement as the requirements system is replacing the old bitVersion setting.

For Example

```json
"requirements": {
    "bit": {
        "version": "2024.1.0",
        "level": "1",
    },
    "jupiter": {
        "version": "0.2.0",
        "level": "2",
    },
    "dismon": {
        "version": "2.0.0",
        "level": "3",
    },
    "logging": {
        "version": "2.0.0",
        "level": "4",
    }
}
```

The above code will

1. Check if the current bit version is 2024.1.0
2. Fail to start if bit is not installed or the version is not 2024.1.0
3. Check if the Jupiter plugin is installed
4. Fail to start if the plugin isn't loaded, but will output to the console of the version is not the same.
5. Check if the bot has the Dismon Plugin 2.0.0
6. If Dismon is not found, the bot will instead output to the console and parts of this plugin will be disabled. If the version does not match, the bot will only output to the console.
7. Check if the logging plugin is installed
8. Fail to start if it is.

There are 3 requirement levels

Level 1, requires the external plugin at that specific version be loaded for your plugin to work.

Level 2, requires the external plugin to be loaded regardless of said external plugins version

Level 3, is basically a soft requirement, the external plugin is not "required" but part of the your plugin will not work without it. (You should include a check for this in your code)

Level 4, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.

## Plugin ID's

Plugins now use an ID system to make it easier for developers wanting to use your code, to do their code. Plugin IDs will be used for plugin requirements, querying plugins (ex. loading the plugin list), and other bot functions. All plugins must use unique ID's when loaded into the bot, otherwise the bot will disable the plugin loaded second (We will only enforce plugin ID's in our certified plugins program. Plugins with the ID of bit-core will cause the bot to crash).

Plugin ID requirements are:

MUST be in Kebab Case (ex. kebab-case)!

CANNOT include numbers!

CANNOT include symbols bar the dash (-) that replaces the space!

CANNOT include a space - this WILL break the bot, use a dash (-) instead!

CANNOT use the name `bit-core`

CANNOT use offensive language.

## update.json changes

All options are now in snake case, however plugins that are made for older versions of Bit should use the legacy values. The "latest" field has been removed and all the various bit versions are under an array, if your plugin is available for legacy versions of Bit, please use the legacy values as well (We're aware this may be annoying for some, as Bit matures and we start to create a consistent code style, various things will change)

Update JSON Example

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.1": "2.0.0"
    }
}
```

Update JSON Example with Legacy Options - As the "developer" option was never actually used, it should NOT be used when legacy versions are available.

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.1": "2.0.0",
    },
    "downloadLink": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "latest": "2.0.0",
    "5.1": "1.0.0",
    "5.0": "1.0.0"
}
```

## New command options

Commands have been updated to include some new custom values. These new custom values allow for creating user-installable apps!

**Cooldown -** The cooldown setting sets an optional cooldown (defaults to 3 seconds) on bot commands. This setting is in seconds.

**integration\_types** - This array allows for setting when different commands CAN show up in the client, for example setting integration\_types.user to true allows the command to be seen/used when the bot is used as a user-installed app, and integration\_types.guild allows the command to be seen/used when the bot is used as a guild-installed app (the way bots have always been installed). Both options can be true.

**context\_types** - This array allows for setting where a command can show up in the client. For example, context\_types.guild\_channel allows the command to be seen in guild channels, context\_types.bot\_dm allows the command to be seen in the bots DM's and context\_types.private\_channel allows the command to be used in the users private DM's (with other people) and group DMs. However context\_types.private\_channel only works if the integration\_types.user is on.

| Option                          | Value Type | Default Value |
| ------------------------------- | ---------- | ------------- |
| cooldown                        | integer    | 5             |
| integration\_types.user         | boolean    | true          |
| integration\_types.guild        | boolean    | true          |
| context\_types.guild\_channel   | boolean    | true          |
| context\_types.bot\_dm          | boolean    | true          |
| context\_types.private\_channel | boolean    | true          |

Format

```javascript
// Cooldowns can be any number upto the 32-bit integer limit. This number is in seconds!
cooldowns: 5,

integration_types: {
    user: true,
    guild: true,
},

context_types: {
    guild_channel: true,
    bot_dm: true,
    private_channel: true,
},
```

## Run code on bot startup

Bit now allows plugins to run code on startup!

This means that within your plugin.json file you can tell the bot to run the code within the mainFile file!

The starting function MUST be called `startFunction` the casing of the function name MAY change in the future to increase consistency within Bit.

Example - index.js from Bit: Core

```javascript
module.exports = {
    startFunction: function startFunction() {
        console.log("Bit: Core Successfully Loaded!")
    }
};
```


# Welcome

{% hint style="warning" %}
This version of Bit will enter End of Support the 4th of July 2025.

This means it will only receive major bug fixing and security updates!
{% endhint %}

Bit is a completely customisable Discord Bot

Source Code: <https://github.com/Lockyz-Media/bit>

Created by Lockyz Media [https://lockyzmedia.com/](https://lockyzmedia.com)

## Updating to Bit 2024.2?

For the Bot [Updating](/docs/2024.2/updating)

For Plugin Developers [Updating to Bit 2024.2](/docs/2024.2/dev/create-plugins/updating-to-bit-2024.2)

## Wanting to make a plugin?

Simply follow our guide [Create Plugins](/docs/2024.2/dev/create-plugins)


# Updating

{% hint style="warning" %}
This version of Bit will enter End of Support the 4th of July 2025.

This means it will only receive major bug fixing and security updates!
{% endhint %}

### Bit 2024.1 to Bit 2024.2

#### Things to remember

* Make sure ALL plugins are updated to any version from Bit 2024.1-2024.2
  * Bit 2024.1 made major changes to how plugins work, and Bit 2024.2 makes various other changes
* Delete every single file and folder from Bit excluding the plugins folder (though remove the bit-core plugin) and the config.json file

#### Updating config.json

Bit 2024.2 makes use of a new configs folder, simply move you config.json file to /configs/bit

#### Update ALL plugins to their latest versions

All plugins must be updated for use in Bit 2024.1 or Bit 2024.2, however we HIGHLY recommend making sure your plugins work for Bit 2024.2

#### Update your node modules and deploy commands

Open the bot in the terminal of your choice and run the `npm i` command.

Once that is done run `node deploy.js` to deploy the bots commands.

#### And you're done

Aside from plugin-specific updates, you should now be fine to run Bit. Simply use the `node bit.js` command and you're all set!


# Commands

As part of the Bit Core plugin, Bit (without any other plugins) only has the following commands

| Command | Usage    | Description                               |
| ------- | -------- | ----------------------------------------- |
| Info    | /info    | Get advanced information about the bot    |
| Plugins | /plugins | List all plugins available within the bot |


# FAQ

## Where can I get support?

We have a whole discord server for support which you can [find here](https://discord.gg/NgpN3YYbMM)

## Will this give me a virus?

Nope, unless you found the "source" code on a shady site that has inserted a virus.

THIS BOT IS FREE, if you've paid for it, you've been scammed, contact your bank, there's unfoprunetly nothing we can do to help

## Can you add feature X?

You're always welcome to suggest features on our [Discord Server](https://discord.gg/NgpN3YYbMM). Or you can make a pull request on our [GitHub repo](https://github.com/Lockyz-Media/bit)


# Install Plugins

Follow the documentation listed on the plugins documentation page. Or follow the basic example below (some plugins will require installing specific node.js modules and will not work if these modules are not installed prior)

Simply unzip the plugins folder into the bit/plugins folder.

If a plugin adds a config, please follow the plugin authors instructions on using it. Some plugins do not use the configs folder yet.

You should then run the deploy script `deploy.js`


# Create Plugins

Get started making plugins for Bit

## Getting Started

1. Download our example plugin
2. Customise it to your hearts content
3. Email us at <lockyzmedia@gmail.com> to get your plugin certified

These guides assume you already know basic node.js and/or how to create a Discord bot using discord.js


# Commands

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for commands found here <https://discordjs.guide/creating-your-bot/slash-commands.html#individual-command-files>
{% endhint %}

### Command Example <a href="#command-example" id="command-example"></a>

```javascript
const { EmbedBuilder, version: discordVersion, SlashCommandBuilder } = require('discord.js')
const moment = require('moment');
require('moment-duration-format');
const language = require('../../../config.json')

module.exports = {
    cooldown: 5,
    data: new SlashCommandBuilder()
        .setName('info')
        .setNameLocalizations({
            de: 'info',
            fr: 'info',
        })
		.setDescription('Get advanced information about the bot.')
        .setDescriptionLocalizations({
            de: 'Erhalten Sie erweiterte Informationen über den Bot.',
            fr: 'Obtenez des informations avancées sur le bot.',
        })
        .setIntegrationTypes(0,1)
        .setContexts(0,1,2),
	async execute(interaction) {
        const client = interaction.client
        var lan = language;
        const locale = require('../../../locale/'+lan+'.json')

        const botUptime = moment.duration(client.uptime).format(' D [days], H [hrs], m [mins], s [secs]');
        const memUsage = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2);
        const guildSize = client.guilds.cache.size.toString();
        const userSize = client.users.cache.size.toString();
        
        var d = new Date();
        var n = d.getFullYear();
        const embed = new EmbedBuilder()
            .setTitle(locale.bot.name)
            .setDescription(locale.bot.description)
            .addFields(
                { name: locale.misc.support, value: "https://discord.gg/NgpN3YYbMM", inline: true },
                { name: locale.misc.developer, value: "Robin Painter", inline: true },
                { name: locale.misc.guilds, value: guildSize, inline: true },
                { name: locale.misc.users, value: userSize, inline: true },
                { name: locale.misc.uptime, value: botUptime, inline: true },
                { name: locale.misc.memory, value: `${Math.round(memUsage)} MB`, inline: true },
                { name: locale.misc.discordJS, value: `v${discordVersion}`, inline: true },
                { name: locale.misc.node, value: `${process.version}`, inline: true },
                { name: locale.misc.version, value: "v5.2.0", inline: true },
                { name: locale.misc.bugTracker, value: "https://tracker.lockyzdev.net/set_project.php?project_id=5", inline: true },
            )
            .setFooter({ text: locale.misc.copyrightText.replace('{year}', n)});
        interaction.reply({ embeds: [embed] })
	}
};
```


# Events

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for that in the meantime <https://discordjs.guide/creating-your-bot/event-handling.html>
{% endhint %}


# 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

```javascript
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")
    }
}
```


# plugin.json

All the plugin.json options for a Bit Plugin and what they're used for

<table data-full-width="true"><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th>Default Value</th></tr></thead><tbody><tr><td>name</td><td>The plugins name</td><td>string</td><td>Bit Core</td></tr><tr><td>id</td><td>The plugins ID</td><td>string (requirements below)</td><td>bit-core</td></tr><tr><td>developer</td><td>The plugins developer</td><td>string</td><td>Lockyz Media</td></tr><tr><td>version</td><td>What version the plugin is</td><td>string</td><td>2024.1.0</td></tr><tr><td>support</td><td>A place to go to get support</td><td>string</td><td><a href="https://github.com/Lockyz-Media/bit/issues">https://github.com/Lockyz-Media/bit/issues</a></td></tr><tr><td>update_url</td><td>A url pointing to a json file used for the update notification system</td><td>string/url</td><td><a href="https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json">https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json</a></td></tr><tr><td>events</td><td>Whether the plugin has events or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>commands</td><td>whether the plugin has slash commands or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>hasIndex</td><td>Whether the plugin can start on bot startup or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>mainFile</td><td>The file the bot should use to find the startup function</td><td>string</td><td>index.js</td></tr><tr><td>list_in_plugins_command</td><td>Whether to display the plugin in the plugins command</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>requirements</td><td>The various requirements for the plugin</td><td>array</td><td>See Below</td></tr></tbody></table>

Example

```json
{
    "name": "Bit Core",
    "id": "bit-core",
    "developer": "Lockyz Media",
    "version": "2024.1.0",
    "support": "https://github.com/Lockyz-Media/bit/issues",
    "update_url": "https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json",
    "events": true,
    "commands": true,
    "hasIndex": true,
    "mainFile": "index.js",
    "list_in_plugins_command": true,
    "requirements": {
        "bit": {
            "version": "2024.1.0",
            "level": "1"
        }
    }
}
```

## Plugin IDs

Plugins use an ID system to make it easier for developers wanting to use your code, to do their code. Plugin IDs will be used for plugin requirements, querying plugins (ex. loading the plugin list), and other bot functions. All plugins must use unique ID's when loaded into the bot, otherwise the bot will disable the plugin loaded second (We will only enforce plugin ID's in our certified plugins program. Plugins with the ID of bit-core will cause the bot to crash).

Plugin ID requirements are:

MUST be in Kebab Case (ex. kebab-case)!

CANNOT include numbers!

CANNOT include symbols bar the dash (-) that replaces the space!

CANNOT include a space - this WILL break the bot, use a dash (-) instead!

CANNOT use the name `bit-core`

CANNOT use offensive language.


# update.json

The file required for Bit: Cores plugin update system to work

The bot will check the update json for the latest version of the plugin, where to download it from and what version of Bit: Core it's for.

<table><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>download_link</td><td>A link to the plugins latest version, is sent to the bots console when outdated</td><td>string/url</td><td>true</td></tr><tr><td>bit_version</td><td>Each bit version can have it's own "latest" version. If a specified version is not found the bot will tell the user to update their Bit version.</td><td>array</td><td>true</td></tr></tbody></table>

Update JSON Example

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.2": "2.0.0"
    }
}
```


# Updating to Bit 2024.2

Bit 2024.2 changes very little, however we HIGHLY recommend following this guide to update.

{% hint style="warning" %}
This version of Bit will enter End of Support the 4th of July 2025.

This means it will only receive major bug fixing and security updates!
{% endhint %}

#### Use new context and installation types. <a href="#use-new-context-and-installation-types" id="use-new-context-and-installation-types"></a>

Discord.js officially released the ability to create user-installable apps as of discord.js 14.16.0, as such we've deprecated our old method for this and have switched to the official method.

**Code to remove from commands**

Copy

```
    // Sets if the command can be used with the bot as a user-installed app or a guild-installed app.
    integration_types: {
        user: true,
        guild: true,
    },
    // Sets if the command can be used in a guild-channel, the bots DMs or a private channel (only works IF the command is user-installable, group DMs and regular user DMs)
    context_types: {
		guildChannel: true,
		botDM: true,
		privateChannel: true,
	},
```

**Code to add to commands**

(Should be in the line JUST before async execute(interaction) and include the comma)

Copy

```
.setIntegrationTypes(0,1)
.setContexts(0,1,2)
```

#### Main config moved <a href="#main-config-moved" id="main-config-moved"></a>

Bits main config file has been moved to /configs/bit/ please be sure to update your imports if you use the values in Bits default config file.


# Updating to Bit 2024.1

Bit 2024.1 changes a LOT of things, please follow this guide to get your plugins updated!

{% hint style="warning" %}
This version of Bit will enter End of Support the 4th of July 2025.

This means it will only receive major bug fixing and security updates!
{% endhint %}

As Bit 2024.1 is a major release, previous versions of the bot cannot be supported!

## plugin.json changes

All settings now use snake-case for their names!

The events and commands values have been changed to use booleans instead of strings (this is to prevent issues) and plugin versions are now required to use semantic versioning (major.minor.patch)

The bitVersion field is being removed as it will now be part of the requirements settings

| Option                     | Value Type | Default Value                                                           | Status                                                                  |
| -------------------------- | ---------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| name                       | string     | Bit Core                                                                |                                                                         |
| id                         | string     | bit-core                                                                | NEW                                                                     |
| developer                  | string     | Lockyz Media                                                            |                                                                         |
| version                    | string     | 2024.1.0                                                                | <p>CHANGED<br>- Now requires semantic versioning</p>                    |
| support                    | string     | <https://github.com/Lockyz-Media/bit/issues>                            |                                                                         |
| update\_url                | string     | <https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json> | <p>CHANGED<br>- Option ID is now in snake case</p>                      |
| events                     | boolean    | false                                                                   | <p>CHANGED<br>- Now a boolean</p>                                       |
| commands                   | boolean    | true                                                                    | <p>CHANGED<br>- Now a boolean</p>                                       |
| hasIndex                   | boolean    | true                                                                    | NEW                                                                     |
| mainFile                   | string     | index.js                                                                | NEW                                                                     |
| list\_in\_plugins\_command | boolean    | true                                                                    | NEW                                                                     |
| requirements               | array      | See Below                                                               | <p>NEW<br><br>Requitements are not yet used bar the Bit requirement</p> |

Example plugin.json

```json
{
    "name": "Bit Core",
    "id": "bit-core",
    "developer": "Lockyz Media",
    "version": "2024.1.0",
    "support": "https://github.com/Lockyz-Media/bit/issues",
    "update_url": "https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json",
    "events": true,
    "commands": true,
    "hasIndex": true,
    "mainFile": "index.js",
    "list_in_plugins_command": true,
    "requirements": {
        "bit": {
            "version": "2024.1.0",
            "level": "1"
        }
    }
}
```

## How will plugin requirements work

{% hint style="danger" %}
Plugins Requirements are being saved for another update. Please keep the only requirement as Bit.
{% endhint %}

The bot will cross reference the plugin requirements array within the plugin.json file with the bots plugin list (Currently not available). Each requirement will be listed as plugin-id:version within the Plugin List.

Plugins are required to have bit as a level 1 requirement as the requirements system is replacing the old bitVersion setting.

For Example

```json
"requirements": {
    "bit": {
        "version": "2024.1.0",
        "level": "1",
    },
    "jupiter": {
        "version": "0.2.0",
        "level": "2",
    },
    "dismon": {
        "version": "2.0.0",
        "level": "3",
    },
    "logging": {
        "version": "2.0.0",
        "level": "4",
    }
}
```

The above code will

1. Check if the current bit version is 2024.1.0
2. Fail to start if bit is not installed or the version is not 2024.1.0
3. Check if the Jupiter plugin is installed
4. Fail to start if the plugin isn't loaded, but will output to the console of the version is not the same.
5. Check if the bot has the Dismon Plugin 2.0.0
6. If Dismon is not found, the bot will instead output to the console and parts of this plugin will be disabled. If the version does not match, the bot will only output to the console.
7. Check if the logging plugin is installed
8. Fail to start if it is.

There are 3 requirement levels

Level 1, requires the external plugin at that specific version be loaded for your plugin to work.

Level 2, requires the external plugin to be loaded regardless of said external plugins version

Level 3, is basically a soft requirement, the external plugin is not "required" but part of the your plugin will not work without it. (You should include a check for this in your code)

Level 4, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.

## Plugin ID's

Plugins now use an ID system to make it easier for developers wanting to use your code, to do their code. Plugin IDs will be used for plugin requirements, querying plugins (ex. loading the plugin list), and other bot functions. All plugins must use unique ID's when loaded into the bot, otherwise the bot will disable the plugin loaded second (We will only enforce plugin ID's in our certified plugins program. Plugins with the ID of bit-core will cause the bot to crash).

Plugin ID requirements are:

MUST be in Kebab Case (ex. kebab-case)!

CANNOT include numbers!

CANNOT include symbols bar the dash (-) that replaces the space!

CANNOT include a space - this WILL break the bot, use a dash (-) instead!

CANNOT use the name `bit-core`

CANNOT use offensive language.

## update.json changes

All options are now in snake case, however plugins that are made for older versions of Bit should use the legacy values. The "latest" field has been removed and all the various bit versions are under an array, if your plugin is available for legacy versions of Bit, please use the legacy values as well (We're aware this may be annoying for some, as Bit matures and we start to create a consistent code style, various things will change)

Update JSON Example

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.1": "2.0.0"
    }
}
```

Update JSON Example with Legacy Options - As the "developer" option was never actually used, it should NOT be used when legacy versions are available.

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.1": "2.0.0",
    },
    "downloadLink": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "latest": "2.0.0",
    "5.1": "1.0.0",
    "5.0": "1.0.0"
}
```

## New command options

Commands have been updated to include some new custom values. These new custom values allow for creating user-installable apps!

**Cooldown -** The cooldown setting sets an optional cooldown (defaults to 3 seconds) on bot commands. This setting is in seconds.

**integration\_types** - This array allows for setting when different commands CAN show up in the client, for example setting integration\_types.user to true allows the command to be seen/used when the bot is used as a user-installed app, and integration\_types.guild allows the command to be seen/used when the bot is used as a guild-installed app (the way bots have always been installed). Both options can be true.

**context\_types** - This array allows for setting where a command can show up in the client. For example, context\_types.guild\_channel allows the command to be seen in guild channels, context\_types.bot\_dm allows the command to be seen in the bots DM's and context\_types.private\_channel allows the command to be used in the users private DM's (with other people) and group DMs. However context\_types.private\_channel only works if the integration\_types.user is on.

| Option                          | Value Type | Default Value |
| ------------------------------- | ---------- | ------------- |
| cooldown                        | integer    | 5             |
| integration\_types.user         | boolean    | true          |
| integration\_types.guild        | boolean    | true          |
| context\_types.guild\_channel   | boolean    | true          |
| context\_types.bot\_dm          | boolean    | true          |
| context\_types.private\_channel | boolean    | true          |

Format

```javascript
// Cooldowns can be any number upto the 32-bit integer limit. This number is in seconds!
cooldowns: 5,

integration_types: {
    user: true,
    guild: true,
},

context_types: {
    guild_channel: true,
    bot_dm: true,
    private_channel: true,
},
```

## Run code on bot startup

Bit now allows plugins to run code on startup!

This means that within your plugin.json file you can tell the bot to run the code within the mainFile file!

The starting function MUST be called `startFunction` the casing of the function name MAY change in the future to increase consistency within Bit.

Example - index.js from Bit: Core

```javascript
module.exports = {
    startFunction: function startFunction() {
        console.log("Bit: Core Successfully Loaded!")
    }
};
```


# Welcome

{% hint style="warning" %}
This version of Bit will enter End of Support the 23rd of April 2025.

This means it will only receive major bug fixing and security updates!
{% endhint %}

Bit is a completely customisable Discord Bot

Source Code: <https://github.com/Lockyz-Media/bit>

Created by Lockyz Media [https://lockyzmedia.com/](https://lockyzmedia.com)

## Updating to Bit 2024.1?

For the Bot [Updating](/docs/2024.1/updating)

For Plugin Developers [Updating to Bit 2024.1](/docs/2024.1/dev/create-plugins/updating-to-bit-2024.1)

## Wanting to make a plugin?

Simply follow our guide [Create Plugins](/docs/2024.1/dev/create-plugins)


# Updating

{% hint style="warning" %}
This version of Bit will enter End of Support the 23rd of April 2025.

This means it will only receive major bug fixing and security updates!
{% endhint %}

### Bit 5.2 to Bit 2024.1

#### Things to remember

* Make sure ALL plugins are updated to 2024.1
  * Bit 2024.1 makes MAJOR changes to the bots command handler. Things WILL break
* Make sure to delete all the Bit and Bit Core files. This means EVERYTHING bar the /plugins folder and then everything inside the /plugins/bit-core folder!

#### Updating config.json

All config options are in snake case now. Please see the example below!

The config now requires a guild\_only, language and dev\_only field, you can follow the format below (using their default values)

```
"guildOnly": false,
"language": "en",
"devmode": false
```

Currently, language can only be "en".

Example

```json
{
    "embed_colours": {
        "positive": "#00FF1C",
        "negative": "#FF0000",
        "neutral": "#9013FE",
        "main": "#86C1FD",
        "secondary": "#50E3C2"
    },
    "botIDs": {
        "logs": "LOGGING ID",
        "guild": "GUILD ID",
        "client": "CLIENT/APPLICATION ID",
        "owner": "OWNER ID"
    },
    "activities": {
        "type": "custom, playing, listening or watching",
        "state": "The text that displays as the status",
        "status": "online, idle, invisible or dnd"
    },
    "guildOnly": false,
    "language": "en",
    "devmode": false,
    "token": "BOT TOKEN"
}
```


# Commands

As part of the Bit Core plugin, Bit (without any other plugins) only has the following commands

| Command | Usage    | Description                               |
| ------- | -------- | ----------------------------------------- |
| Info    | /info    | Get advanced information about the bot    |
| Plugins | /plugins | List all plugins available within the bot |


# FAQ

## Where can I get support?

We have a whole discord server for support which you can [find here](https://discord.gg/NgpN3YYbMM)

## Will this give me a virus?

Nope, unless you found the "source" code on a shady site that has inserted a virus.

THIS BOT IS FREE, if you've paid for it, you've been scammed, contact your bank, there's unfoprunetly nothing we can do to help

## Can you add feature X?

You're always welcome to suggest features on our [Discord Server](https://discord.gg/NgpN3YYbMM). Or you can make a pull request on our [GitHub repo](https://github.com/Lockyz-Media/bit)


# Install Plugins

Follow the documentation listed on the plugins documentation page. Or follow the basic example below (some plugins will require installing specific node.js modules and will not work if these modules are not installed prior)

Simply unzip the plugins folder into the bit/plugins folder.

You should then run the deploy script `deploy.js`


# Create Plugins

Get started making plugins for Bit

## Getting Started

1. Download our example plugin
2. Customise it to your hearts content
3. Email us at <lockyzmedia@gmail.com> to get your plugin certified

These guides assume you already know basic node.js and/or how to create a Discord bot using discord.js


# Commands

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for commands found here <https://discordjs.guide/creating-your-bot/slash-commands.html#individual-command-files>
{% endhint %}

{% hint style="warning" %}
Bit has some custom data inserted into the regular discord.js command object. Please read the following command example for information on this!
{% endhint %}

### Command Example <a href="#command-example" id="command-example"></a>

```javascript
const { EmbedBuilder, version: discordVersion, SlashCommandBuilder } = require('discord.js')
const moment = require('moment');
require('moment-duration-format');
const language = require('../../../config.json')

module.exports = {
    cooldown: 5,
    // Sets if the command can be used with the bot as a user-installed app or a guild-installed app.
    integration_types: {
        user: false,
        guild: true,
    },

    // Sets if the command can be used in a guild-channel, the bots DMs or a private channel (only works IF the command is user-installable, group DMs and regular user DMs)
    context_types: {
	guildChannel: true,
	botDM: true,
	privateChannel: true,
},

	data: new SlashCommandBuilder()
		.setName('info')
        .setNameLocalizations({
            de: 'info',
            fr: 'info',
        })
		.setDescription('Get advanced information about the bot.')
        .setDescriptionLocalizations({
            de: 'Erhalten Sie erweiterte Informationen über den Bot.',
            fr: 'Obtenez des informations avancées sur le bot.',
        })
        .setDMPermission(false),
	async execute(interaction) {
        const client = interaction.client
        var lan = language;
        const locale = require('../../../locale/'+lan+'.json')

        const botUptime = moment.duration(client.uptime).format(' D [days], H [hrs], m [mins], s [secs]');
        const memUsage = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2);
        const guildSize = client.guilds.cache.size.toString();
        const userSize = client.users.cache.size.toString();
        
        var d = new Date();
        var n = d.getFullYear();
        const embed = new EmbedBuilder()
            .setTitle(locale.bot.name)
            .setDescription(locale.bot.description)
            .addFields(
                { name: locale.misc.support, value: "https://discord.gg/NgpN3YYbMM", inline: true },
                { name: locale.misc.developer, value: "Robin Painter", inline: true },
                { name: locale.misc.guilds, value: guildSize, inline: true },
                { name: locale.misc.users, value: userSize, inline: true },
                { name: locale.misc.uptime, value: botUptime, inline: true },
                { name: locale.misc.memory, value: `${Math.round(memUsage)} MB`, inline: true },
                { name: locale.misc.discordJS, value: `v${discordVersion}`, inline: true },
                { name: locale.misc.node, value: `${process.version}`, inline: true },
                { name: locale.misc.version, value: "v5.2.0", inline: true },
                { name: locale.misc.bugTracker, value: "https://tracker.lockyzdev.net/set_project.php?project_id=5", inline: true },
            )
            .setFooter({ text: locale.misc.copyrightText.replace('{year}', n)});
        interaction.reply({ embeds: [embed] })
	}
};
```


# Events

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for that in the meantime <https://discordjs.guide/creating-your-bot/event-handling.html>
{% endhint %}


# 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

```javascript
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")
    }
}
```


# plugin.json

All the plugin.json options for a Bit Plugin and what they're used for

<table data-full-width="true"><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th>Default Value</th></tr></thead><tbody><tr><td>name</td><td>The plugins name</td><td>string</td><td>Bit Core</td></tr><tr><td>id</td><td>The plugins ID</td><td>string (requirements below)</td><td>bit-core</td></tr><tr><td>developer</td><td>The plugins developer</td><td>string</td><td>Lockyz Media</td></tr><tr><td>version</td><td>What version the plugin is</td><td>string</td><td>2024.1.0</td></tr><tr><td>support</td><td>A place to go to get support</td><td>string</td><td><a href="https://github.com/Lockyz-Media/bit/issues">https://github.com/Lockyz-Media/bit/issues</a></td></tr><tr><td>update_url</td><td>A url pointing to a json file used for the update notification system</td><td>string/url</td><td><a href="https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json">https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json</a></td></tr><tr><td>events</td><td>Whether the plugin has events or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>commands</td><td>whether the plugin has slash commands or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>hasIndex</td><td>Whether the plugin can start on bot startup or not</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>mainFile</td><td>The file the bot should use to find the startup function</td><td>string</td><td>index.js</td></tr><tr><td>list_in_plugins_command</td><td>Whether to display the plugin in the plugins command</td><td>boolean (true/false)</td><td>true</td></tr><tr><td>requirements</td><td>The various requirements for the plugin</td><td>array</td><td>See Below</td></tr></tbody></table>

Example

```json
{
    "name": "Bit Core",
    "id": "bit-core",
    "developer": "Lockyz Media",
    "version": "2024.1.0",
    "support": "https://github.com/Lockyz-Media/bit/issues",
    "update_url": "https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json",
    "events": true,
    "commands": true,
    "hasIndex": true,
    "mainFile": "index.js",
    "list_in_plugins_command": true,
    "requirements": {
        "bit": {
            "version": "2024.1.0",
            "level": "1"
        }
    }
}
```

## Plugin IDs

Plugins use an ID system to make it easier for developers wanting to use your code, to do their code. Plugin IDs will be used for plugin requirements, querying plugins (ex. loading the plugin list), and other bot functions. All plugins must use unique ID's when loaded into the bot, otherwise the bot will disable the plugin loaded second (We will only enforce plugin ID's in our certified plugins program. Plugins with the ID of bit-core will cause the bot to crash).

Plugin ID requirements are:

MUST be in Kebab Case (ex. kebab-case)!

CANNOT include numbers!

CANNOT include symbols bar the dash (-) that replaces the space!

CANNOT include a space - this WILL break the bot, use a dash (-) instead!

CANNOT use the name `bit-core`

CANNOT use offensive language.


# update.json

The file required for Bit: Cores plugin update system to work

The bot will check the update json for the latest version of the plugin, where to download it from and what version of Bit: Core it's for.

<table><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>download_link</td><td>A link to the plugins latest version, is sent to the bots console when outdated</td><td>string/url</td><td>true</td></tr><tr><td>bit_version</td><td>Each bit version can have it's own "latest" version. If a specified version is not found the bot will tell the user to update their Bit version.</td><td>array</td><td>true</td></tr></tbody></table>

Update JSON Example

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.2": "2.0.0"
    }
}
```


# Updating to Bit 2024.1

Bit 2024.1 changes a LOT of things, please follow this guide to get your plugins updated!

{% hint style="warning" %}
This version of Bit will enter End of Support the 23rd of April 2025.

This means it will only receive major bug fixing and security updates!
{% endhint %}

As Bit 2024.1 is a major release, previous versions of the bot cannot be supported!

## plugin.json changes

All settings now use snake-case for their names!

The events and commands values have been changed to use booleans instead of strings (this is to prevent issues) and plugin versions are now required to use semantic versioning (major.minor.patch)

The bitVersion field is being removed as it will now be part of the requirements settings

| Option                     | Value Type | Default Value                                                           | Status                                                                  |
| -------------------------- | ---------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| name                       | string     | Bit Core                                                                |                                                                         |
| id                         | string     | bit-core                                                                | NEW                                                                     |
| developer                  | string     | Lockyz Media                                                            |                                                                         |
| version                    | string     | 2024.1.0                                                                | <p>CHANGED<br>- Now requires semantic versioning</p>                    |
| support                    | string     | <https://github.com/Lockyz-Media/bit/issues>                            |                                                                         |
| update\_url                | string     | <https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json> | <p>CHANGED<br>- Option ID is now in snake case</p>                      |
| events                     | boolean    | false                                                                   | <p>CHANGED<br>- Now a boolean</p>                                       |
| commands                   | boolean    | true                                                                    | <p>CHANGED<br>- Now a boolean</p>                                       |
| hasIndex                   | boolean    | true                                                                    | NEW                                                                     |
| mainFile                   | string     | index.js                                                                | NEW                                                                     |
| list\_in\_plugins\_command | boolean    | true                                                                    | NEW                                                                     |
| requirements               | array      | See Below                                                               | <p>NEW<br><br>Requitements are not yet used bar the Bit requirement</p> |

Example plugin.json

```json
{
    "name": "Bit Core",
    "id": "bit-core",
    "developer": "Lockyz Media",
    "version": "2024.1.0",
    "support": "https://github.com/Lockyz-Media/bit/issues",
    "update_url": "https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json",
    "events": true,
    "commands": true,
    "hasIndex": true,
    "mainFile": "index.js",
    "list_in_plugins_command": true,
    "requirements": {
        "bit": {
            "version": "2024.1.0",
            "level": "1"
        }
    }
}
```

## How will plugin requirements work

{% hint style="danger" %}
Plugins Requirements are being saved for another update. Please keep the only requirement as Bit.
{% endhint %}

The bot will cross reference the plugin requirements array within the plugin.json file with the bots plugin list (Currently not available). Each requirement will be listed as plugin-id:version within the Plugin List.

Plugins are required to have bit as a level 1 requirement as the requirements system is replacing the old bitVersion setting.

For Example

```json
"requirements": {
    "bit": {
        "version": "2024.1.0",
        "level": "1",
    },
    "jupiter": {
        "version": "0.2.0",
        "level": "2",
    },
    "dismon": {
        "version": "2.0.0",
        "level": "3",
    },
    "logging": {
        "version": "2.0.0",
        "level": "4",
    }
}
```

The above code will

1. Check if the current bit version is 2024.1.0
2. Fail to start if bit is not installed or the version is not 2024.1.0
3. Check if the Jupiter plugin is installed
4. Fail to start if the plugin isn't loaded, but will output to the console of the version is not the same.
5. Check if the bot has the Dismon Plugin 2.0.0
6. If Dismon is not found, the bot will instead output to the console and parts of this plugin will be disabled. If the version does not match, the bot will only output to the console.
7. Check if the logging plugin is installed
8. Fail to start if it is.

There are 3 requirement levels

Level 1, requires the external plugin at that specific version be loaded for your plugin to work.

Level 2, requires the external plugin to be loaded regardless of said external plugins version

Level 3, is basically a soft requirement, the external plugin is not "required" but part of the your plugin will not work without it. (You should include a check for this in your code)

Level 4, the plugin will NOT start if a plugin of this level is also loaded. This can be used for plugins that are incompatible with yours.

## Plugin ID's

Plugins now use an ID system to make it easier for developers wanting to use your code, to do their code. Plugin IDs will be used for plugin requirements, querying plugins (ex. loading the plugin list), and other bot functions. All plugins must use unique ID's when loaded into the bot, otherwise the bot will disable the plugin loaded second (We will only enforce plugin ID's in our certified plugins program. Plugins with the ID of bit-core will cause the bot to crash).

Plugin ID requirements are:

MUST be in Kebab Case (ex. kebab-case)!

CANNOT include numbers!

CANNOT include symbols bar the dash (-) that replaces the space!

CANNOT include a space - this WILL break the bot, use a dash (-) instead!

CANNOT use the name `bit-core`

CANNOT use offensive language.

## update.json changes

All options are now in snake case, however plugins that are made for older versions of Bit should use the legacy values. The "latest" field has been removed and all the various bit versions are under an array, if your plugin is available for legacy versions of Bit, please use the legacy values as well (We're aware this may be annoying for some, as Bit matures and we start to create a consistent code style, various things will change)

Update JSON Example

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.1": "2.0.0"
    }
}
```

Update JSON Example with Legacy Options - As the "developer" option was never actually used, it should NOT be used when legacy versions are available.

```json
{
    "download_link": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "bit_versions": {
        "2024.1": "2.0.0",
    },
    "downloadLink": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "latest": "2.0.0",
    "5.1": "1.0.0",
    "5.0": "1.0.0"
}
```

## New command options

Commands have been updated to include some new custom values. These new custom values allow for creating user-installable apps!

**Cooldown -** The cooldown setting sets an optional cooldown (defaults to 3 seconds) on bot commands. This setting is in seconds.

**integration\_types** - This array allows for setting when different commands CAN show up in the client, for example setting integration\_types.user to true allows the command to be seen/used when the bot is used as a user-installed app, and integration\_types.guild allows the command to be seen/used when the bot is used as a guild-installed app (the way bots have always been installed). Both options can be true.

**context\_types** - This array allows for setting where a command can show up in the client. For example, context\_types.guild\_channel allows the command to be seen in guild channels, context\_types.bot\_dm allows the command to be seen in the bots DM's and context\_types.private\_channel allows the command to be used in the users private DM's (with other people) and group DMs. However context\_types.private\_channel only works if the integration\_types.user is on.

| Option                          | Value Type | Default Value |
| ------------------------------- | ---------- | ------------- |
| cooldown                        | integer    | 5             |
| integration\_types.user         | boolean    | true          |
| integration\_types.guild        | boolean    | true          |
| context\_types.guild\_channel   | boolean    | true          |
| context\_types.bot\_dm          | boolean    | true          |
| context\_types.private\_channel | boolean    | true          |

Format

```javascript
// Cooldowns can be any number upto the 32-bit integer limit. This number is in seconds!
cooldowns: 5,

integration_types: {
    user: true,
    guild: true,
},

context_types: {
    guild_channel: true,
    bot_dm: true,
    private_channel: true,
},
```

## Run code on bot startup

Bit now allows plugins to run code on startup!

This means that within your plugin.json file you can tell the bot to run the code within the mainFile file!

The starting function MUST be called `startFunction` the casing of the function name MAY change in the future to increase consistency within Bit.

Example - index.js from Bit: Core

```javascript
module.exports = {
    startFunction: function startFunction() {
        console.log("Bit: Core Successfully Loaded!")
    }
};
```


# Welcome

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

{% hint style="danger" %}
This section will be removed the 6th of March 2026
{% endhint %}

Bit is a completely customisable Discord Bot

Source Code: <https://github.com/Lockyz-Media/bit>

Created by Lockyz Media [https://lockyzmedia.com/](https://lockyzmedia.com)


# Updating

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

We no longer recommend updating to this version of Bit. However you can find a link to help you update to the latest version of Bit below.

{% content-ref url="/spaces/XssWwRDGc4FdnhEqn4Vf/pages/IthjLRFXkDMPRHTfZ6mq" %}
[Updating](/docs/updating)
{% endcontent-ref %}


# Commands

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

As part of the Bit Core plugin, Bit (without any other plugins) only has the following commands

| Command | Usage    | Description                               |
| ------- | -------- | ----------------------------------------- |
| Info    | /info    | Get advanced information about the bot    |
| Plugins | /plugins | List all plugins available within the bot |


# FAQ

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

## Where can I get support?

We have a whole discord server for support which you can [find here](https://discord.gg/NgpN3YYbMM)

## Will this give me a virus?

Nope, unless you found the "source" code on a shady site that has inserted a virus.

THIS BOT IS FREE, if you've paid for it, you've been scammed, contact your bank, there's unfoprunetly nothing we can do to help

## Can you add feature X?

You're always welcome to suggest features on our [Discord Server](https://discord.gg/NgpN3YYbMM). Or you can make a pull request on our [GitHub repo](https://github.com/Lockyz-Media/bit)


# Install Plugins

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

Follow the documentation listed on the plugins documentation page. Or follow the basic example below (some plugins will require installing specific node.js modules and will not work if these modules are not installed prior)

Simply unzip the plugins folder into the bit/plugins folder.

You should then run the deploy script `deploy.js`


# Create Plugins

Get started making plugins for Bit

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

## Getting Started

1. Download our example plugin
2. Customise it to your hearts content
3. Email us at <lockyzmedia@gmail.com> to get your plugin certified

These guides assume you already know basic node.js and/or how to create a Discord bot using discord.js


# Commands

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for commands found here <https://discordjs.guide/creating-your-bot/slash-commands.html#individual-command-files>
{% endhint %}

### Command Example <a href="#command-example" id="command-example"></a>

```javascript
const { EmbedBuilder, version: discordVersion, SlashCommandBuilder } = require('discord.js')
const moment = require('moment');
require('moment-duration-format');

module.exports = {
	data: new SlashCommandBuilder()
		.setName('info')
        .setNameLocalizations({
            de: 'info',
            fr: 'info',
        })
		.setDescription('Get advanced information about the bot.')
        .setDescriptionLocalizations({
            de: 'Erhalten Sie erweiterte Informationen über den Bot.',
            fr: 'Obtenez des informations avancées sur le bot.',
        })
        .setDMPermission(false),
	async execute(interaction) {
        const client = interaction.client
        var lan = 'en'
        const locale = require('../locale/'+lan+'.json')

        const botUptime = moment.duration(client.uptime).format(' D [days], H [hrs], m [mins], s [secs]');
        const memUsage = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2);
        
        var d = new Date();
        var n = d.getFullYear();
        const embed = new EmbedBuilder()
            .setTitle(client.user.globalName)
            .addFields(
                { name: locale.misc.support, value: "https://discord.gg/NgpN3YYbMM", inline: true },
                { name: locale.misc.developer, value: "Lockyz Media", inline: true },
                { name: locale.misc.uptime, value: botUptime, inline: true },
                { name: locale.misc.memory, value: `${Math.round(memUsage)} MB`, inline: true },
                { name: locale.misc.discordJS, value: `v${discordVersion}`, inline: true },
                { name: locale.misc.node, value: `${process.version}`, inline: true },
                { name: locale.misc.version, value: "v5.2.3", inline: true },
            )
            .setFooter({ text: locale.misc.copyrightText.replace('{year}', n)});
        interaction.reply({ embeds: [embed] })
	}
};
```


# Events

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

{% hint style="danger" %}
This guide is unfinished! We recommend following discord.js's guide for that in the meantime <https://discordjs.guide/creating-your-bot/event-handling.html>
{% endhint %}


# plugin.json

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

All the plugin.json options for a Bit Plugin and what they're used for

<table data-full-width="true"><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th>Default Value</th></tr></thead><tbody><tr><td>name</td><td>The plugins name</td><td>string</td><td>Bit Core</td></tr><tr><td>developer</td><td>The plugins developer</td><td>string</td><td>Lockyz Media</td></tr><tr><td>version</td><td>What version the plugin is</td><td>string</td><td>5.2.3</td></tr><tr><td>support</td><td>A place to go to get support</td><td>string</td><td><a href="https://github.com/Lockyz-Media/bit/issues">https://github.com/Lockyz-Media/bit/issues</a></td></tr><tr><td>updateURL</td><td>A url pointing to a json file used for the update notification system</td><td>string/url</td><td><a href="https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json">https://cdn.lockyzmedia.com/discord/bots/bit/plugins/core/update.json</a></td></tr><tr><td>events</td><td>Whether the plugin has events or not</td><td>string(true or false)</td><td>false</td></tr><tr><td>commands</td><td>whether the plugin has slash commands or not</td><td>string(true or false)</td><td>true</td></tr><tr><td>bitVersions</td><td>The version of Bit this plugin uses</td><td>string</td><td>5.2.3</td></tr></tbody></table>

Example

```json
{
    "name": "Bit Core",
    "developer": "Robin Painter",
    "version": "5.2.3",
    "bitVersion": "5.2.3",
    "support": "https://github.com/Lockyz-Dev/bit-core/issues",
    "updateURL": "https://cdn.lockyzmedia.com/discord/bit/update/core/update.json",
    "events": "false",
    "commands": "true"
}
```


# update.json

The file required for Bit: Cores plugin update system to work

{% hint style="danger" %}
This version of Bit has reached End of Life, this means it'll no longer receive ANY updates.

By continuing to use this version, you take full responsibility for any security issues that may be present.
{% endhint %}

The bot will check the update json for the latest version of the plugin, where to download it from and what version of Bit: Core it's for.

<table><thead><tr><th>Option</th><th>Description</th><th>Accepted Values</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>downloadLink</td><td>A link to the plugins latest version, is sent to the bots console when outdated</td><td>string/url</td><td>true</td></tr><tr><td>5.2</td><td>The latest version for Bit 5.2</td><td>string</td><td>true</td></tr><tr><td>5.1</td><td>The latest version for Bit 5.1</td><td>string</td><td>false</td></tr><tr><td>5.0</td><td>The latest version for Bit 5.0</td><td>string</td><td>false</td></tr></tbody></table>

Update JSON Example

```json
{
    "latest": "5.2.0",
    "developer": "Lockyz Dev",
    "downloadLink": "https://cdn.lockyzmedia.com/bit/plugins/xp/latest.zip",
    "5.2": "5.2.0",
    "5.1": "5.1.0",
    "5.0": "5.0.0"
}
```


# Welcome

The place for all the plugins available within Bit!

This section shows off ALL the Bit Certified plugins available for Bit 2025.2


# Bit: Core

Bit: Core is a plugin baked into Bit

Bit: Core is a plugin built into bit, it contains ALL the default commands, events and functions accessible within the bot.

Developer: Lockyz Media

User Installable: :white\_check\_mark:

Guild Installable: :white\_check\_mark:

Source Code: [GitHub](https://github.com/Bit-Plugins/bit-core)


# Bit: Welcoming

A welcome plugin created for Bit 2025.2

Developer: Lockyz Media

User Installable: :x:

Guild Installable: :white\_check\_mark:

Source Code: [GitHub](https://github.com/Bit-Plugins/Bit-Welcoming)




---

[Next Page](/llms-full.txt/1)

