5.1.1 • Published 10 months ago

@bambusgamer/toolbox v5.1.1

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

Toolbox

Package

Content

Classes

CommandBuilder

const { CommandBuilder } = require('@bambusgamer/toolbox');

module.exports = new CommandBuilder({
    slash: {
        data: (client, modules) => ({
            name: '',
            name_localizations: {},
            type: 1,
            description: '',
            description_localizations: {},
            options: [],
            default_member_permissions: [],
            dm_permission: false,
            nsfw: false,
        }),
        async autocomplete(client, modules, interaction) { },
        async callback(client, modules, interaction) { },
    },
    text: {
        data: (client, modules) => ({
            name: '',
            aliases: [],
            category: '',
            permissions: [],
            description: '',
            usage: '',
            example: [],
            dm_permission: false,
        }),
	async callback(client, modules, message) {},
    },
})

EventBuilder

const { EventBuilder } = require('@bambusgamer/toolbox');

module.exports = new EventBuilder({
    name: 'ready',
    once: true,
    listener: '',
    async callback(client, modules) { },
    ...keys,
});

InteractionBuilder

const { InteractionBuilder } = require('@bambusgamer/toolbox');

module.exports = new InteractionBuilder({
    customId: '',
    async callback(client, modules, interaction) { },
    ...keys,
});

Modules

AntiCrash

const { Anticrash } = require('@bambusgamer/toolbox');

Anticrash.init();

Config

Loads a .js or .json file

const { Config } = require('@bambusgamer/toolbox');

const config = new Config('');

// reload
config.reload();

Handler

const { Handler } = require('@bambusgamer/toolbox');

const handler = new Handler({
	client,
	paths: {
		commands: '',
		events: '',
		interactions: '',
	},
	restToken: '',
});

// reload
handler.reload();

Localizer

const { Localizer } = require('@bambusgamer/toolbox');

const localizer = new Localizer('');

// get key in default Language
localizer.getDefault('key', ...placeholders);
// get key in all Languages
localizer.getAll('key', ...placeholders);
// get key in Language
localizer.get('en-US', 'key', ...placeholders);

Localizationpack:

module.exports = {
    defaultLanguage: 'en-US',
    languages: ['en-US'],
    strings: {
        'en-US': {
		'key': 'value {{1}}',
        },
    },
};

Logger

const { Logger } = require('@bambusgamer/toolbox');

new Logger('');

Mongoose

const { Mongoose } = require('@bambusgamer/toolbox');

Mongoose.init('');

Discord

Message structure

{
  "reactions": [
    {
      "count": 1,
      "me": false,
      "emoji": {
        "id": null,
        "name": "🔥"
      }
    }
  ],
  "attachments": [],
  "tts": false,
  "embeds": [],
  "timestamp": "2017-07-11T17:27:07.299000+00:00",
  "mention_everyone": false,
  "id": "334385199974967042",
  "pinned": false,
  "edited_timestamp": null,
  "author": {
    "username": "Mason",
    "discriminator": "9999",
    "id": "53908099506183680",
    "avatar": "a_bab14f271d565501444b2ca3be944b25"
  },
  "mention_roles": [],
  "content": "Supa Hot",
  "channel_id": "290926798999357250",
  "mentions": [],
  "type": 0
}

Interactions

Commands

Types:

  1. Chat_input
  2. User
  3. Message

Localization:

{
	"locale": "localized"
}

Option types:

  1. Sub_Command
  2. Sub_Command_Group
  3. String
  4. Integer (Any integer between -2^53 and 2^53)
  5. Boolean
  6. User
  7. Channel (Includes all channel types + categories)
  8. Role
  9. Mentionable (Includes users and roles)
  10. Number (Any double between -2^53 and 2^53)
  11. Attachment

Example:

{
	type: 1,
	name: "command",
	name_localizations: {"de-DE": "befehl"},
	description: "Does stuff",
	description_localizations: {"de-DE": "Macht Dinge"},
    	options: [
        {
            type: 2,
            name: "subcommandGroup",
            name_localizations: {"de-DE": "unterbefehlgruppe"},
            description: "Does stuff",
            description_localizations: {"de-DE": "Macht Dinge"},
            options: [
                {
                    type: 1,
                    name: "subcommand",
                    name_localizations: {"de-DE": "unterbefehl"},
                    description: "Does stuff",
                    description_localizations: {"de-DE": "Macht Dinge"},
                    options: [
                        {
                            type: 3,
                            name: "string",
                            name_localizations: {"de-DE": "zeichenkette"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            min_length: 0,
                            max_length: 100,
                            required: true,
                        },
                        {
                            type: 3,
                            name: "stringSelect",
                            name_localizations: {"de-DE": "zeichenketteauswahl"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            choices: [
                                {
                                    name: "choice",
                                    name_localizations: {"de-DE": "auswahl"},
                                    value: "value",
                                },
                            ],
                            required: true,
                        },
                        {
                            type: 4,
                            name: "integer",
                            name_localizations: {"de-DE": "ganzzahl"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            min_value: 0,
                            max_value: 100,
                            required: true,
                        },
                        {
                            type: 5,
                            name: "boolean",
                            name_localizations: {"de-DE": "logisch"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            required: true,
                        },
                        {
                            type: 6,
                            name: "user",
                            name_localizations: {"de-DE": "benutzer"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            required: true,
                        },
                        {
                            type: 7,
                            name: "channel",
                            name_localizations: {"de-DE": "kanal"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            required: true,
                        },
                        {
                            type: 8,
                            name: "role",
                            name_localizations: {"de-DE": "rolle"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            required: true,
                        },
                        {
                            type: 9,
                            name: "mentionable",
                            name_localizations: {"de-DE": "erwähnbar"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            required: true,
                        },
                        {
                            type: 10,
                            name: "number",
                            name_localizations: {"de-DE": "zahl"},
                            description: "Does stuff",
                            description_localizations: {"de-DE": "Macht Dinge"},
                            min_value: 0,
                            max_value: 100,
                            required: true,
                        },
        }
    ],
    default_member_permissions: [],
    dm_permission: false,
    nsfw: false,
}

Message Components

Types:

  1. Action Row
  2. Button
  3. String Select
  4. Text Input
  5. User Select
  6. Role Select
  7. Mentionable Select
  8. Channel Select

Button Styles:

  1. Primary
  2. Secondary
  3. Success
  4. Danger
  5. Link

Button emojis:

{
    name: "emoji",
    id: "emoji_id",
    animated: true,
}

Example:

[
    {
        type: 1,
        components: [
            {
                type: 2,
                label: "Button",
                label_localizations: {"de-DE": "Knopf"},
                style: 1,
                custom_id: "button",
            },
            {
                type: 2,
                label: "Link",
                label_localizations: {"de-DE": "Link"},
                style: 5,
                url: "https://google.com",
            },
            {
                type: 2,
                label: "Emoji",
                label_localizations: {"de-DE": "Emoji"},
                style: 1,
                custom_id: "emoji",
                emoji: {
                    name: "emoji",
                    id: "emoji_id",
                    animated: true,
                },
            }
        ]
    },
    {
        type: 1,
        components: [
            {
                type: 3,
                placeholder: "Select",
                placeholder_localizations: {"de-DE": "Auswählen"},
                custom_id: "select",
                options: [
                    {
                        label: "Option",
                        label_localizations: {"de-DE": "Auswahl"},
                        value: "value",
                        description: "Description",
                        description_localizations: {"de-DE": "Beschreibung"},
                        emoji: {
                            name: "emoji",
                            id: "emoji_id",
                            animated: true,
                        },
                    },
                ],
            },
        ]
    },
    {
        type: 1,
        components: [
            {
                type: 5,
                placeholder: "User",
                placeholder_localizations: {"de-DE": "Benutzer"},
                custom_id: "user",
            },
        ]
    },
]

Modals

Text Input Types:

  1. Short
  2. Paragraph

Example:

{
    title: "Modal",
    title_localizations: {"de-DE": "Modal"},
    description: "Description",
    description_localizations: {"de-DE": "Beschreibung"},
    components: [
        {
            type: 1,
            components: [
                {
                    type: 4,
                    label: "Input",
                    placeholder: "Placeholder",
                    value: "Default Value",
                    custom_id: "input",
                    min_length: 0,
                    max_length: 100,
                    type: 1,
                },
            ],
        },
        {
            type: 1,
            components: [
                {
                    type: 3,
                    placeholder: "Select",
                    placeholder_localizations: {"de-DE": "Auswählen"},
                    custom_id: "select",
                    options: [
                        {
                            label: "Option",
                            label_localizations: {"de-DE": "Auswahl"},
                            value: "value",
                            description: "Description",
                            description_localizations: {"de-DE": "Beschreibung"},
                            emoji: {
                                name: "emoji",
                                id: "emoji_id",
                                animated: true,
                            },
                        },
                    ],
                },
            ],
        }
    ],
}
5.1.1

10 months ago

5.1.0

10 months ago

1.6.0

11 months ago

2.0.0

11 months ago

4.0.0

11 months ago

5.0.0

11 months ago

1.5.0

11 months ago

3.1.0

11 months ago

4.3.0

11 months ago

1.4.6

11 months ago

1.4.5

11 months ago

1.8.0

11 months ago

3.0.0

11 months ago

4.2.0

11 months ago

1.7.0

11 months ago

4.1.0

11 months ago

1.4.7

11 months ago

1.4.3

11 months ago

1.4.2

11 months ago

1.4.1

11 months ago

1.4.0

11 months ago

1.3.2

11 months ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.8

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.12

1 year ago

1.2.13

1 year ago

1.2.10

1 year ago

1.2.11

1 year ago

1.2.14

1 year ago

1.1.55

1 year ago

1.1.54

1 year ago

1.2.9

1 year ago

1.1.53

1 year ago

1.1.52

1 year ago

1.1.51

1 year ago

1.1.50

1 year ago

1.1.49

1 year ago

1.1.48

1 year ago

1.1.47

1 year ago

1.1.46

1 year ago

1.1.45

1 year ago

1.1.44

1 year ago

1.1.43

1 year ago

1.1.42

1 year ago

1.1.41

1 year ago

1.1.40

1 year ago

1.1.39

1 year ago

1.1.38

1 year ago

1.1.37

1 year ago

1.1.36

1 year ago

1.1.35

1 year ago

1.1.34

1 year ago

1.1.33

1 year ago

1.1.32

1 year ago

1.1.31

1 year ago

1.1.30

2 years ago

1.1.29

2 years ago

1.1.28

2 years ago

1.1.27

2 years ago

1.1.26

2 years ago

1.1.25

2 years ago

1.1.24

2 years ago

1.1.23

2 years ago

1.1.22

2 years ago

1.1.21

2 years ago

1.1.20

2 years ago

1.1.19

2 years ago

1.1.18

2 years ago

1.1.17

2 years ago

1.1.16

2 years ago

1.1.15

2 years ago

1.1.14

2 years ago

1.1.13

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago