API for dealing with message entities easily
tbot should have an easy API for dealing with entities, especially since that Telegram returns lengths and offsets in UTF-16 codepoints, while Rust's Strings are UTF-8. Something like this:
use tbot::util::entities;
//
bot.text(|context| {
for entity in entities(context.text) {
dbg!(entity);
// Entity {
// value: "normal, ",
// formatting: Formatting {
// // ..
// }
// }
// Entity {
// value: "bold, ",
// formatting: Formatting {
// bold: true,
// // ..
// }
// }
// Entity {
// value: "bold and italic",
// formatting: Formatting {
// bold: true,
// italic: true,
// // ..
// }
// }
}
});