-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with clicking #313
Comments
Clicking hasn't been added as a friendly method. You'll need to invoke the raw request for https://docs.rs/grammers-tl-types/latest/grammers_tl_types/functions/messages/struct.GetBotCallbackAnswer.html yourself. |
Thank you very much. Everything works great 🫶 If someone suddenly needs an example (I hope that it will help you): async fn handle_update(client: Client, update: Update) -> Result<()> {
match update {
Update::NewMessage(message) if !message.outgoing() => {
let chat = message.chat();
let peer = match chat {
grammers_client::types::Chat::User(user) => {
let pack = user.pack();
tl::enums::InputPeer::User(tl::types::InputPeerUser {
user_id: user.id(),
access_hash: pack.access_hash.unwrap_or(0),
})
}
grammers_client::types::Chat::Group(group) => todo!(),
grammers_client::types::Chat::Channel(channel) => todo!(),
};
let callback = message.reply_markup();
if let Some(tl::enums::ReplyMarkup::ReplyInlineMarkup(keyboard)) = callback {
for row in keyboard.rows {
let buttons = match row {
tl::enums::KeyboardButtonRow::Row(buttons) => buttons,
_ => continue,
};
for button in buttons.buttons {
if let tl::enums::KeyboardButton::Callback(callback) = button {
if callback.text == "test_text" {
let data = callback.data.clone();
client
.invoke(&tl::functions::messages::GetBotCallbackAnswer {
game: false,
peer: peer.clone(),
msg_id: message.id(),
data: Some(data),
password: None,
})
.await?;
}
}
}
}
}
}
_ => {}
}
Ok(())
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello everyone. Sorry for such a question, but I really can't find information on this matter anywhere. How to emulate clicking on the Inline button? Maybe with the help of invoke and TL? Does anyone have a working example?
The text was updated successfully, but these errors were encountered: