use crate::HandlerConfig; use anyhow::{anyhow, Context as _, Result}; use serenity::all::{Context, Message}; use std::ops::ControlFlow; const TWITTER_URLS: &[&str] = &[ "https://fixupx.com/", "https://fixvx.com/", "https://pbs.twimg.com/", "https://t.co/", "https://twitter.com/", "https://x.com/", ]; const REACTS: &[char] = &['🇶', '🇺', '🇮', '🇹', '🐦']; pub async fn on_message( _config: &HandlerConfig, ctx: &Context, msg: &Message, ) -> Result> { let is_twitter = TWITTER_URLS.iter().any(|url| msg.content.contains(url)); if !is_twitter { return Ok(ControlFlow::Continue(())); } for &react in REACTS { msg.react(&ctx.http, react) .await .with_context(|| anyhow!("Failed to react with {react} on a Twitter message"))?; } Ok(ControlFlow::Break(())) }