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_reactionanddelete_all_reactionsmust call the Telegram API and surface bothok: falseresponses asModerationError::Apiand transport failures asModerationError::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_membercheck and returnModerationError::Apiwhen the bot is not an administrator, rather than forwarding aForbiddenerror from the API.
Required Methods§
Sourcefn 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_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.
Sourcefn delete_all_reactions<'a>(
&'a self,
chat_id: i64,
message_id: i64,
user_id: i64,
) -> 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>>
Remove all reactions left by user_id on a message.
§Errors
Returns ModerationError on API or transport failure.