Custom commands are a great way to personalize your bot. You can set predefined messages or even send media such as photos, videos, and files that your bot will reply with whenever given a certain word or phrase. This is very useful and may help you add an FAQ to your bot, testimonials, and more. If you have programming knowledge and skills, you'll be able to create even more complex commands!
To create a custom command, simply type /custom_commands in your bot's chat and select the "Add" option. This will prompt you to set a trigger phrase and a response message. You can even attach photos, videos, or files to your response to make it more engaging. With custom commands, you can personalize your bot to meet the specific needs of your audience.
Then, your bot will prompt you to enter a name for your new command. This name will be the trigger phrase that activates the message you create next.
After naming your custom command, you'll be prompted to enter the message that your bot will send to users when they type the command. This can be any type of content, including text, media, and files. You can also add multiple messages to your custom command to provide more than one response. Additionally, you can use captions to further personalize your messages.
After clicking the "Save" button, your custom command is ready to use! Users can trigger it by typing the name of the command you created. Don't forget to test your custom command and make sure it works as expected. You can always go back and edit or delete the custom command if needed by going to /custom_commands and selecting the appropriate option.
After creating a custom command, users will be able to launch it by either typing its name or clicking on the button that appears on the /start menu.
Clicking on this button will display your message. If you've entered several messages, the user will see a "Next" button that allows them to cycle through the responses.
If you have programming skills and knowledge, you can create advanced custom commands for your TGmembership-powered bot. To get started, type /custom_commands and click "Add" to create a new command, just like you would for a basic command. Instead of entering a message, click on the "Click through your own server" button and enter a URL address where your script is located. Whenever someone uses this command, TGmembership will forward the update from Telegram to your script, giving you the freedom to manipulate and use this data however you wish.
Here's an example of what a request might look like:
"first_name": "John Doe",
"first_name": "John Doe",
"text": "More complex command"
With the API token and the data provided in the request, you have all the tools you need to execute any logic your command may require. You can query Telegram's API directly and manipulate the data as needed to achieve your desired outcome.
Now, whenever someone starts your bot they will see both commands. When users click on the "My first custom command", the bot will reply with your predefined messages. When users click on the "More complex command", the bot will send a request to your own server, where you can process the data and respond however you want.