mirror of
https://github.com/kristoferssolo/tg-relay-rs.git
synced 2026-02-04 06:42:09 +00:00
feat: add platforms as features
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||
use teloxide::{Bot, prelude::Requester, respond, types::Message};
|
||||
use tg_relay_rs::{
|
||||
comments::{Comments, init_global_comments},
|
||||
handlers::{InstagramHandler, SocialHandler, YouTubeShortsHandler},
|
||||
handlers::SocialHandler,
|
||||
telemetry::setup_logger,
|
||||
};
|
||||
use tracing::{error, info, warn};
|
||||
@@ -27,8 +27,12 @@ async fn main() -> color_eyre::Result<()> {
|
||||
let bot = Bot::from_env();
|
||||
info!("bot starting");
|
||||
|
||||
let handlers: Vec<Arc<dyn SocialHandler>> =
|
||||
vec![Arc::new(InstagramHandler), Arc::new(YouTubeShortsHandler)];
|
||||
let handlers: Vec<Arc<dyn SocialHandler>> = vec![
|
||||
#[cfg(feature = "instagram")]
|
||||
Arc::new(tg_relay_rs::handlers::InstagramHandler),
|
||||
#[cfg(feature = "youtube")]
|
||||
Arc::new(tg_relay_rs::handlers::YouTubeShortsHandler),
|
||||
];
|
||||
|
||||
teloxide::repl(bot.clone(), move |bot: Bot, msg: Message| {
|
||||
// clone the handlers vector into the closure
|
||||
|
||||
Reference in New Issue
Block a user