use chrono::NaiveDateTime; use telers::{errors::session::ErrorKind, methods::*, types::ChatPermissions, Bot}; #[inline] pub async fn restrict( bot: &Bot, user_id: i64, duration: NaiveDateTime, chat_id: i64, ) -> Result { bot.send( restrict_chat_member::RestrictChatMember::new( chat_id, user_id, ChatPermissions::new() .can_send_photos(false) .can_send_polls(false) .can_send_audios(false) .can_send_videos(false) .can_change_info(false) .can_invite_users(false) .can_send_other_messages(false) .can_pin_messages(false) .can_send_messages(false) .can_send_voice_notes(false) .can_send_video_notes(false) .can_send_documents(false) .can_manage_topics(false), ) .until_date(duration.and_utc().timestamp()), ) .await } #[inline] pub async fn demote_user(bot: &Bot, user_id: i64, chat_id: i64) -> Result { bot.send( PromoteChatMember::new(chat_id, user_id) .can_manage_topics(false) .can_pin_messages(false) .can_invite_users(false) .can_change_info(false) .can_promote_members(false) .can_restrict_members(false) .can_manage_voice_chats(false) .can_delete_messages(false) .can_edit_messages(false) .can_post_messages(false) .can_manage_chat(false) .is_anonymous(false), ) .await }