Closed SadsHelp closed 1 year ago
Regarding your first issue: different kind of message types delete and recreate the menu as they cant be edited. So the message gets deleted and another spammed button press tries to edit that same message that was just deleted. So yeah, if someone wants to spam, it can create errors but that isn't helpful behaviour anyway so :shrug:
Regarding your second issue: You can manually send a menu. Check the README for that. In your case you would need to remember if a chat has a menu or not so you need additional state which is not great for efficient bots. Also a use is able to delete the menu message which the bot doesnt know so it can not be perfect. Therefore I would just stick with a command like /start (which gets automatically executed on first bot usage) and save it as a bot command so the user can use it again.
And just something I noticed in your code: You commented out the bot.use(middleware)
part which basically disables the menu to respond.
Hope it helped!
thanks for your reply, the spam causes the bot to crash, maybe if you put a delay like 1 second so if someone is trying to spam he cant, and also as i told you im new so i need an efficient example menu code i can depend on, is the example code 100% alright or it does need some editing
I tried to spam the buttons but the example in this repo does not crash so I can't reproduce this. Generally you want to use Error Handling in your bot.
As far as I know this example works and is there to be an example. Nothing is ever perfect so in case there is an issue with it feel free to report it. But as as there weren't reported any issues with it for ages and nothing changed much is very likely to be alright.
thanks again for the reply, well the error only happens when media buttons are being spammed it says message to edit not found i will try to make it so every sub menu has 1 document to prevent spamming, also i was wondering if it possible to edit the back to main menu button text i tried to search for the file didnt find it also there is kind of advanced thing i want it to be added if you could make it for like paid addon i would be glad, the idea is adding buttons from the bot it self and the button type is either text or media or sub menu , the images i provided are in arabic but i hope you get the idea
another example with keyboard buttons
You can use the helper createBackMainMenuButtons
to create some back and main menu buttons. The helper allows for two arguments to change the text of the buttons (useful for i18n)
You can also create the buttons you need fully yourself with menu.navigate
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Hi, how are you i hope you are doing fine, sorry if im bothering, few days ago i came across your menu library on github, im not a developer but i needed to make a bot for my channel, there are many paid bots that i cant use so i learned the basics of java script and tried to run the code, i used the example code, i did it successfully but i run into some issues because im new and i didn't fully understand the methods and functions etc..
First issue: when i spam the buttons on the media menu i get an error says message to edit not found
Second issue i tried to remove the start command and made it so everytime you use the bot If the menu is not sent the bot will send it and if the menu is sent it will be only updated
So for the summary im not understanding how to send the main menu and how to update
this is my code https://controlc.com/7f355177
i have many users and the bot might get thousands of users so i need an efficient bot to use
i hope if you have a more efficient example on using the library please send it to me
if there is a paid service to setup the main code i can do that and thanks for your work