Skip to content

Conversation

@studplus
Copy link
Contributor

@studplus studplus commented Sep 3, 2020

add function for setting up custom trainername

@jinnatar
Copy link
Collaborator

jinnatar commented Sep 6, 2020

@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.

@jinnatar jinnatar added enhancement New feature or request question Further information is requested labels Sep 6, 2020
@jinnatar jinnatar self-assigned this Sep 6, 2020
@studplus
Copy link
Contributor Author

studplus commented Sep 6, 2020

@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.

@jinnatar
Copy link
Collaborator

jinnatar commented Sep 6, 2020

@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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 '/'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like that idea! @Artanicus
This way we would not need a trainername_time database field at all 😁

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants