grammers
grammers copied to clipboard
The is_bot flag is incorrectly interpreted for messages from a bot without a keyboard
For messages without an attached keyboard that the bot sends, the Chat::User(user) type attached to the message has the flag user.is_bot() == False, although if the keyboard is attached, then user.is_bot() == True
Are you sure the message wasn't sent @via inline? The library doesn't modify the bot flag returned by Telegram in any way:
https://github.com/Lonami/grammers/blob/04d95775e01f52e8326e1d1e203ee1b5137ee518/lib/grammers-client/src/types/chat/user.rs#L247-L249
Are you sure the message wasn't sent
@via inline? The library doesn't modify thebotflag returned by Telegram in any way:https://github.com/Lonami/grammers/blob/04d95775e01f52e8326e1d1e203ee1b5137ee518/lib/grammers-client/src/types/chat/user.rs#L247-L249
Of this kind
Can you check what value the min field has?
Can you check what value the
minfield has?
impl ChatTypeFilter {
pub(crate) async fn handle(&self, context: &ComponentContext<'_>) -> bool {
if self.chat_types.len() == 0 {
return false;
}
ChatTypeForFilter::is_contains(&self.chat_types, &context.message.chat())
}
}
impl ChatTypeForFilter {
pub fn is_contains(array: &Vec<Self>, chat: &Chat) -> bool {
if array.len() == 0 {
return false;
}
return match chat {
Chat::User(user) => {
println!("{}", user.is_bot());
println!("{}", user.min());
if user.is_bot() {
if array.contains(&ChatTypeForFilter::Bot) {
return true;
}
} else {
if array.contains(&ChatTypeForFilter::Private) {
return true;
}
}
false
}
Chat::Group(_) => {
if array.contains(&ChatTypeForFilter::Group) {
return true;
}
false
}
Chat::Channel(_) => {
if array.contains(&ChatTypeForFilter::SuperGroup) {
return true;
}
false
}
};
}
}
false
false