Skip to main content

ReactionModerationBackend

Trait ReactionModerationBackend 

Source
pub trait ReactionModerationBackend: Send + Sync {
    // Required methods
    fn delete_reaction<'a>(
        &'a self,
        chat_id: i64,
        message_id: i64,
        user_id: i64,
        reaction: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), ModerationError>> + Send + 'a>>;
    fn delete_all_reactions<'a>(
        &'a self,
        chat_id: i64,
        message_id: i64,
        user_id: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), ModerationError>> + Send + 'a>>;
}
Expand description

Backend that executes reaction-moderation API calls.

Implementors are expected to call the Telegram Bot API. The trait is object-safe (all methods return pinned boxed futures) so ModerationExecutor can hold it as Arc<dyn ReactionModerationBackend>.

§Contract

  • delete_reaction and delete_all_reactions must call the Telegram API and surface both ok: false responses as ModerationError::Api and transport failures as ModerationError::Http.
  • The bot must be an administrator with appropriate rights in the target chat before calling these methods; implementations SHOULD perform a pre-flight get_chat_member check and return ModerationError::Api when the bot is not an administrator, rather than forwarding a Forbidden error from the API.

Required Methods§

Source

fn delete_reaction<'a>( &'a self, chat_id: i64, message_id: i64, user_id: i64, reaction: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), ModerationError>> + Send + 'a>>

Remove a single reaction left by user_id on a message.

§Errors

Returns ModerationError on API or transport failure.

Source

fn delete_all_reactions<'a>( &'a self, chat_id: i64, message_id: i64, user_id: i64, ) -> Pin<Box<dyn Future<Output = Result<(), ModerationError>> + Send + 'a>>

Remove all reactions left by user_id on a message.

§Errors

Returns ModerationError on API or transport failure.

Implementors§