Conversation
setname_time to trainername_time
|
@studplus Your code doesn't contain any comments so it's a bit difficult to understand what it's doing and why this needs to live in the core instead of the raidbot. Can you explain your logic here a bit? If it truly must live in the core then pretty please add comments so that it's clear what's going on. |
|
@Artanicus Sorry, I've added some comments. The difficulty is here to get the answer from the user. So if the User wants to change his user-name, he got to type in his name and send this to the bot. The only point, I know until now, is the core->bot->commands.php. Here all messages arrive to the bot. If you know another way, where the bot can fetch the Name-Change-Message, you're welcome to tell me. I didn't know another point. |
|
@studplus I dug a bit deeper and we already actually collect the Telegram nicknames of people, they're just not used anywhere. Would this be a much simpler solution? I'm afraid that people won't remember / bother to set their custom usernames. |
| // IF a Message type is private and there is no leading '/' | ||
| else if($update['message']['chat']['type'] == 'private'){ | ||
| // Get Message from User sent to Bot and check what to do | ||
| evaluate_priv_message($update); |
There was a problem hiding this comment.
Since this function is not available in this project this will fail if not implemented in all bots dependent on the core. evaluate_priv_message sounds like functionality that should live in the core, but then that can discover handlers set by individual bots. It's a bit more work but should enable way better features in the future. :-)
| sendMessage($update['message']['chat']['id'], '<b>' . getTranslation('not_supported') . '</b>'); | ||
| } | ||
| } | ||
| // IF a Message type is private and there is no leading '/' |
There was a problem hiding this comment.
Just to clarify, we're not evaluating a command but a reply to a command?
Telegram has built in functionality for getting responses, could we not use that: https://core.telegram.org/bots/api#forcereply ?
There was a problem hiding this comment.
Really like that idea! @Artanicus
This way we would not need a trainername_time database field at all 😁
There was a problem hiding this comment.
We're not really built for using forceReply efficiently so I'll do some plumbing in telegram/functions.php to generalize the $inline_keyboard to a $reply_markup array.
add function for setting up custom trainername