mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 06:35:38 +01:00
Fix
This commit is contained in:
@@ -25,7 +25,7 @@ pub struct Config {
|
|||||||
pub files_url: String,
|
pub files_url: String,
|
||||||
|
|
||||||
pub bot_tokens: Vec<String>,
|
pub bot_tokens: Vec<String>,
|
||||||
pub temp_channel_username: String,
|
pub temp_channel_id: i64,
|
||||||
|
|
||||||
pub sentry_dsn: String,
|
pub sentry_dsn: String,
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ impl Config {
|
|||||||
files_url: get_env("FILES_SERVER_URL"),
|
files_url: get_env("FILES_SERVER_URL"),
|
||||||
|
|
||||||
bot_tokens: serde_json::from_str(&get_env("BOT_TOKENS")).unwrap(),
|
bot_tokens: serde_json::from_str(&get_env("BOT_TOKENS")).unwrap(),
|
||||||
temp_channel_username: get_env("TEMP_CHANNEL_USERNAME"),
|
temp_channel_id: get_env("TEMP_CHANNEL_ID").parse().unwrap(),
|
||||||
|
|
||||||
sentry_dsn: get_env("SENTRY_DSN"),
|
sentry_dsn: get_env("SENTRY_DSN"),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ pub struct CacheData {
|
|||||||
pub object_id: i32,
|
pub object_id: i32,
|
||||||
pub object_type: String,
|
pub object_type: String,
|
||||||
pub message_id: i32,
|
pub message_id: i32,
|
||||||
pub chat_id: String,
|
pub chat_id: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static CHAT_DONATION_NOTIFICATIONS_CACHE: Lazy<Cache<i32, MessageId>> = Lazy::new(|| {
|
pub static CHAT_DONATION_NOTIFICATIONS_CACHE: Lazy<Cache<i32, MessageId>> = Lazy::new(|| {
|
||||||
@@ -47,7 +47,10 @@ pub static CHAT_DONATION_NOTIFICATIONS_CACHE: Lazy<Cache<i32, MessageId>> = Lazy
|
|||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let bot = ROUND_ROBIN_BOT.get_bot();
|
let bot = ROUND_ROBIN_BOT.get_bot();
|
||||||
let _ = bot
|
let _ = bot
|
||||||
.delete_message(config::CONFIG.temp_channel_username.to_string(), message_id)
|
.delete_message(
|
||||||
|
Recipient::Id(ChatId(config::CONFIG.temp_channel_id)),
|
||||||
|
message_id,
|
||||||
|
)
|
||||||
.await;
|
.await;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -80,7 +83,7 @@ pub async fn get_cached_file_copy(original: cached_file::Data, db: Database) ->
|
|||||||
|
|
||||||
let message_id = match bot
|
let message_id = match bot
|
||||||
.copy_message(
|
.copy_message(
|
||||||
config::CONFIG.temp_channel_username.to_string(),
|
Recipient::Id(ChatId(config::CONFIG.temp_channel_id)),
|
||||||
Recipient::Id(ChatId(original.chat_id)),
|
Recipient::Id(ChatId(original.chat_id)),
|
||||||
MessageId(original.message_id.try_into().unwrap()),
|
MessageId(original.message_id.try_into().unwrap()),
|
||||||
)
|
)
|
||||||
@@ -100,7 +103,7 @@ pub async fn get_cached_file_copy(original: cached_file::Data, db: Database) ->
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
bot.copy_message(
|
bot.copy_message(
|
||||||
config::CONFIG.temp_channel_username.to_string(),
|
Recipient::Id(ChatId(config::CONFIG.temp_channel_id)),
|
||||||
Recipient::Id(ChatId(new_original.chat_id)),
|
Recipient::Id(ChatId(new_original.chat_id)),
|
||||||
MessageId(new_original.message_id.try_into().unwrap()),
|
MessageId(new_original.message_id.try_into().unwrap()),
|
||||||
)
|
)
|
||||||
@@ -118,7 +121,7 @@ pub async fn get_cached_file_copy(original: cached_file::Data, db: Database) ->
|
|||||||
object_id: original.object_id,
|
object_id: original.object_id,
|
||||||
object_type: original.object_type,
|
object_type: original.object_type,
|
||||||
message_id: message_id.0,
|
message_id: message_id.0,
|
||||||
chat_id: config::CONFIG.temp_channel_username.to_string(),
|
chat_id: config::CONFIG.temp_channel_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user