SmartBot
Last updated
Was this helpful?
Last updated
Was this helpful?
SmartBot
is a versatile tool designed to enhance bot interaction and management, particularly for multi-language support. This guide focuses on setting up and initializing SmartBot
for your projects, ensuring a smooth start for beginners in programming.
You need setup Lang File. Please read
To use SmartBot
, you first need to create an instance. This is typically done in the main bot file or where you handle your bot's logic.
You need to put this code:
in command - "@"
and create blank (because we need to track all commands we need blank "*" command)
params
: Initial parameters for the bot.
defaultMarkdown
: The default formatting style for messages (e.g., Markdown, HTML).
skip_cmd_folders: Don't process commands in this folders (it can be "Setup", "Admin" folders for example)
strict_params: Default - false. If true - error will be thrown if param not found but it is needed in Command's. It is good for debugging.
debug
: A boolean flag for enabling debugging. Default: false.
SmartBot
manages commands based on the language file. Use the handle
method to process incoming commands and generate appropriate responses.
One of SmartBot
's key features is its ability to handle dynamic content through variables.
Use the add
method to include dynamic content in responses:
Params from options after SmartBot.run (or Bot.run) - are added automatically
Use the run
method to execute another command within a command:
It is same method like Bot.run but current options will be passed automatically
The fill
method replaces all vars like "{data}" in text with actual variable values:
You can change language for user via this code:
If debug
is set to true
, SmartBot
will provide detailed error messages, which is helpful for troubleshooting and ensuring your bot behaves as expected.
Keep Language Files Updated: Regularly update your language files to reflect changes in your bot's functionality.
Test Thoroughly: Always test your bot for various scenarios, especially after adding new features or making changes.
Handle Errors Gracefully: Ensure that your bot handles errors smoothly and provides helpful feedback to users.
Setting up and initializing SmartBot
is a straightforward process. By carefully configuring your language files and utilizing the robust features of SmartBot
, you can create an interactive and user-friendly bot experience. Remember to test extensively and update your language files as your bot evolves.
Prefer to use after all :
You can make "return" in command andwill be not run. It can be helpful in some case.
So we can use username and balance props for command in now:
You can define translation. Read about this .