2KXFHTS3VTQWWMOUVONFJ7GYSX4DCHQ6RQ2LGV6TH5R6X7MH7RNAC
let streaming = if token.is_some() {
client.user_streaming(format!("wss://{}", url))
} else {
client.public_streaming(format!("wss://{}", url))
let streaming = match tl {
Some(ExtraTimeline::Public) => client.public_streaming(format!("wss://{}", url)),
Some(ExtraTimeline::Local) => client.local_streaming(format!("wss://{}", url)),
None => client.user_streaming(format!("wss://{}", url)),
},
};
let extra_tl = match dotenvy::var("EXTRA_TIMELINE") {
Err(_) => None,
Ok(tl_type) => match tl_type.to_lowercase().as_str() {
"public" => Some(ExtraTimeline::Public),
"local" => Some(ExtraTimeline::Local),
_ => panic!("* EXTRA_TIMELINE is invalid. Valid values are Public or Local."),
streamer::streaming(
sns,
url.as_str(),
token,
logging_method,
logging_url,
filter,
)
.await;
// Extra Timeline
let extra_tl_handle = if let Some(tl) = extra_tl {
tokio::spawn(streamer::streaming(
sns.clone(),
url.clone(),
token.clone(),
logging_method.clone(),
logging_url.clone(),
filter.clone(),
Some(tl),
))
} else {
tokio::spawn(async {})
};
// Home Timeline
let home_tl_handle = tokio::spawn(streamer::streaming(
sns.clone(),
url.clone(),
token.clone(),
logging_method.clone(),
logging_url.clone(),
filter.clone(),
None,
));
let _ = tokio::join!(home_tl_handle, extra_tl_handle);
pub fn egosa(message: megalodon::entities::status::Status, settings: Filter) -> bool {
pub fn egosa(
message: megalodon::entities::status::Status,
settings: Filter,
tl: Option<ExtraTimeline>,
) -> bool {
// Remove dupicates from Home Timeline
if tl.is_none()
&& matches!(settings.extra_tl, Some(ExtraTimeline::Public))
&& message.visibility == megalodon::entities::StatusVisibility::Public
{
return false;
}
if tl.is_none()
&& matches!(settings.extra_tl, Some(ExtraTimeline::Local))
&& !message.account.acct.contains("@")
&& message.visibility == megalodon::entities::StatusVisibility::Public
{
return false;
}