totigm / bot-builder

This is a library to create bots for different platforms. It handles all the commands stuff behind the scenes, so you can focus on your bot's logic.
MIT License
6 stars 1 forks source link

🚀 Add language to bot options #1

Open totigm opened 2 years ago

totigm commented 2 years ago

Is your feature request related to a problem? Please describe.

If you want to create a bot in a language other than English, you have to update the whole botMessages property, which can be kind of overwhelming.

Describe the solution you'd like

I would add a new property to the bot options, where you can choose a language.

Implementation proposal

Creating some JSON files, such as en.json, es.json, and so on, and then from the bot options just choose a language (default to en). This option would update the botMessages default value, but you could still update it. Let's say you want to have all the Spanish values for botMessages, but use another help name, you could do the following:

const options: BotOptions = {
    language: "es",
    botMessages: {
        help: {
            name: "your_name",
        }
    }
};

and every other option would be inferred from the es.json file