I want to list some records for the user and add a quick link to do some action on any of them. Something like:
Subject: Hello
ID: 85
Remove link: /remove_85
which when the /remove_85 is tapped, bot would remove that record having ID=85.
How to do it?
Have a look at the WhoisCommand and the example GenericCommand.
You should be able to see how they work, otherwise just ask again.
Thanks @noplanman that was exactly what I'm looking for.
GenericCommand.php was pretty clear.
But in the WhoisCommand on line 77, 78 and 79 there is a part of code that I couldn't find out what it is doing.
if (strpos($text, 'g') === 0) {
$text = str_replace('g', '-', $text);
}
Could you please explain it to me?
Thats for group IDs, they are negative numbers so they are in format '-314234', and because the command line cant look like this: '/whois-314234' (it wouldn't be clickable) we replaced - with g and in the command we check if it exists on that string position and restore the - when needed!
Thank you @jacklul that was very helpful.
Most helpful comment
Thats for group IDs, they are negative numbers so they are in format '-314234', and because the command line cant look like this:
'/whois-314234'(it wouldn't be clickable) we replaced-withgand in the command we check if it exists on that string position and restore the-when needed!