diff options
| -rw-r--r-- | src/lang.rs | 97 |
1 files changed, 47 insertions, 50 deletions
diff --git a/src/lang.rs b/src/lang.rs index aad0413..6b4e747 100644 --- a/src/lang.rs +++ b/src/lang.rs | |||
| @@ -47,10 +47,10 @@ pub fn fmt_cron_audio_queued(cron: &str) -> String { | |||
| 47 | format!("Praca audio zakolejkowana z cron'em `{cron}`") | 47 | format!("Praca audio zakolejkowana z cron'em `{cron}`") |
| 48 | } | 48 | } |
| 49 | pub fn fmt_cron_label_audio(name: &str) -> String { | 49 | pub fn fmt_cron_label_audio(name: &str) -> String { |
| 50 | format!("Audio: {name}") | 50 | format!("Audio: `{name}`") |
| 51 | } | 51 | } |
| 52 | pub fn fmt_cron_label_msg(msg: &str) -> String { | 52 | pub fn fmt_cron_label_msg(msg: &str) -> String { |
| 53 | format!("Wiadomość: {msg}") | 53 | format!("Wiadomość: `{msg}`") |
| 54 | } | 54 | } |
| 55 | pub fn fmt_cron_job_status(id: i64, status: &str) -> String { | 55 | pub fn fmt_cron_job_status(id: i64, status: &str) -> String { |
| 56 | format!("ID {id} — {status}") | 56 | format!("ID {id} — {status}") |
| @@ -59,16 +59,16 @@ pub fn fmt_cron_field(cron: &str, chan: i64, desc: &str) -> String { | |||
| 59 | format!("`{cron}` — <#{chan}>\n{desc}") | 59 | format!("`{cron}` — <#{chan}>\n{desc}") |
| 60 | } | 60 | } |
| 61 | pub fn fmt_cron_deleted(id: i64) -> String { | 61 | pub fn fmt_cron_deleted(id: i64) -> String { |
| 62 | format!("Praca cron z ID {id} została usunięta") | 62 | format!("Praca cron z ID `{id}` została usunięta") |
| 63 | } | 63 | } |
| 64 | pub fn fmt_cron_not_found(id: i64) -> String { | 64 | pub fn fmt_cron_not_found(id: i64) -> String { |
| 65 | format!("Praca z ID {id} nie została znaleziona") | 65 | format!("Praca z ID `{id}` nie została znaleziona") |
| 66 | } | 66 | } |
| 67 | pub fn fmt_cron_paused(id: i64) -> String { | 67 | pub fn fmt_cron_paused(id: i64) -> String { |
| 68 | format!("Praca cron z ID {id} została zapauzowana") | 68 | format!("Praca cron z ID `{id}` została zapauzowana") |
| 69 | } | 69 | } |
| 70 | pub fn fmt_cron_resumed(id: i64) -> String { | 70 | pub fn fmt_cron_resumed(id: i64) -> String { |
| 71 | format!("Praca cron z ID {id} została wznowiona") | 71 | format!("Praca cron z ID `{id}` została wznowiona") |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | // ── Math command ────────────────────────────────────────────────────── | 74 | // ── Math command ────────────────────────────────────────────────────── |
| @@ -80,7 +80,7 @@ pub const L_MATH_DANGEROUS: &str = "Ekspresja zawiera groźne słowa"; | |||
| 80 | pub const L_MATH_NO_RESULT: &str = "Brak rezultatu"; | 80 | pub const L_MATH_NO_RESULT: &str = "Brak rezultatu"; |
| 81 | 81 | ||
| 82 | pub fn fmt_math_qalc_err(e: &dyn std::fmt::Display) -> String { | 82 | pub fn fmt_math_qalc_err(e: &dyn std::fmt::Display) -> String { |
| 83 | format!("qalc nie jest dostępny: {e}") | 83 | format!("qalc nie jest dostępny: `{e}`") |
| 84 | } | 84 | } |
| 85 | pub fn fmt_math_result(r: &str) -> String { | 85 | pub fn fmt_math_result(r: &str) -> String { |
| 86 | format!("```\n{r}\n```") | 86 | format!("```\n{r}\n```") |
| @@ -97,16 +97,16 @@ pub const L_MUSIC_STOPPED: &str = "wyszed"; | |||
| 97 | pub const L_VOICE_USER_NOT_IN_VC: &str = "You are not in a voice channel"; | 97 | pub const L_VOICE_USER_NOT_IN_VC: &str = "You are not in a voice channel"; |
| 98 | 98 | ||
| 99 | pub fn fmt_music_search_failed(e: &dyn std::fmt::Display) -> String { | 99 | pub fn fmt_music_search_failed(e: &dyn std::fmt::Display) -> String { |
| 100 | format!("Szukanie na copyparty zawiodło: {e}") | 100 | format!("Szukanie na copyparty zawiodło: `{e}`") |
| 101 | } | 101 | } |
| 102 | pub fn fmt_music_playing(name: &str) -> String { | 102 | pub fn fmt_music_playing(name: &str) -> String { |
| 103 | format!("Grajcowanie: {name}") | 103 | format!("Grajcowanie: `{name}`") |
| 104 | } | 104 | } |
| 105 | pub fn fmt_voice_joined(cid: &dyn std::fmt::Display) -> String { | 105 | pub fn fmt_voice_joined(cid: &dyn std::fmt::Display) -> String { |
| 106 | format!("Dołączon <#{cid}>") | 106 | format!("Dołączon <#{cid}>") |
| 107 | } | 107 | } |
| 108 | pub fn fmt_voice_join_failed(e: &dyn std::fmt::Display) -> String { | 108 | pub fn fmt_voice_join_failed(e: &dyn std::fmt::Display) -> String { |
| 109 | format!("Nie udało się połączyć z VC: {e}") | 109 | format!("Nie udało się połączyć z VC: `{e}`") |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | // ── TTS command ─────────────────────────────────────────────────────── | 112 | // ── TTS command ─────────────────────────────────────────────────────── |
| @@ -115,10 +115,10 @@ pub const L_TTS_SAVED: &str = "TTS zapisany"; | |||
| 115 | pub const L_TTS_PLAYING: &str = "Grom TTS na kanale głosowym"; | 115 | pub const L_TTS_PLAYING: &str = "Grom TTS na kanale głosowym"; |
| 116 | 116 | ||
| 117 | pub fn fmt_tts_piper_launch(e: &str) -> String { | 117 | pub fn fmt_tts_piper_launch(e: &str) -> String { |
| 118 | format!("Piper sie nie uruchomił w czas: {e}") | 118 | format!("Piper sie nie uruchomił w czas: `{e}`") |
| 119 | } | 119 | } |
| 120 | pub fn fmt_tts_piper_failed(e: &str) -> String { | 120 | pub fn fmt_tts_piper_failed(e: &str) -> String { |
| 121 | format!("Piper TTS sie nie powiodło: {e}") | 121 | format!("Piper TTS sie nie powiodło: `{e}`") |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | // ── Trigger command ─────────────────────────────────────────────────── | 124 | // ── Trigger command ─────────────────────────────────────────────────── |
| @@ -127,16 +127,16 @@ pub const L_TRIGGER_UPDATED: &str = "Trigger zaktualizowany"; | |||
| 127 | pub const L_TRIGGER_KW_NONE: &str = "Brak"; | 127 | pub const L_TRIGGER_KW_NONE: &str = "Brak"; |
| 128 | 128 | ||
| 129 | pub fn fmt_trigger_created(name: &str) -> String { | 129 | pub fn fmt_trigger_created(name: &str) -> String { |
| 130 | format!("Grupa trigger '{name}' utworzona") | 130 | format!("Grupa trigger `{name}` utworzona") |
| 131 | } | 131 | } |
| 132 | pub fn fmt_trigger_failed(e: &dyn std::fmt::Display) -> String { | 132 | pub fn fmt_trigger_failed(e: &dyn std::fmt::Display) -> String { |
| 133 | format!("Nie udało się: {e}") | 133 | format!("Nie udało się: `{e}`") |
| 134 | } | 134 | } |
| 135 | pub fn fmt_trigger_deleted(name: &str) -> String { | 135 | pub fn fmt_trigger_deleted(name: &str) -> String { |
| 136 | format!("Grupa trigger '{name}' usunięta") | 136 | format!("Grupa trigger `{name}` usunięta") |
| 137 | } | 137 | } |
| 138 | pub fn fmt_trigger_title(name: &str) -> String { | 138 | pub fn fmt_trigger_title(name: &str) -> String { |
| 139 | format!("Trigger: {name}") | 139 | format!("Trigger: `{name}`") |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | // ── Utility commands ────────────────────────────────────────────────── | 142 | // ── Utility commands ────────────────────────────────────────────────── |
| @@ -152,41 +152,41 @@ pub const L_UTIL_NO_ATTACHMENTS: &str = "Brak załączników w wiadomości"; | |||
| 152 | pub const L_SEARCH_NO_RESULTS: &str = "No results found"; | 152 | pub const L_SEARCH_NO_RESULTS: &str = "No results found"; |
| 153 | 153 | ||
| 154 | pub fn fmt_util_compressed(url: &str) -> String { | 154 | pub fn fmt_util_compressed(url: &str) -> String { |
| 155 | format!("Skompresowano\n{url}") | 155 | format!("Skompresowano\n`{url}`") |
| 156 | } | 156 | } |
| 157 | pub fn fmt_util_converted(url: &str) -> String { | 157 | pub fn fmt_util_converted(url: &str) -> String { |
| 158 | format!("Skonwertowano\n{url}") | 158 | format!("Skonwertowano\n`{url}`") |
| 159 | } | 159 | } |
| 160 | pub fn fmt_util_convert_err(stderr: &str) -> String { | 160 | pub fn fmt_util_convert_err(stderr: &str) -> String { |
| 161 | format!("Błąd konwersji: {stderr}") | 161 | format!("Błąd konwersji: `{stderr}`") |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | pub fn fmt_uploaded(url: &str) -> String { | 164 | pub fn fmt_uploaded(url: &str) -> String { |
| 165 | format!("Wysłon: {url}") | 165 | format!("Wysłon: `{url}`") |
| 166 | } | 166 | } |
| 167 | pub fn fmt_download_uploaded(url: &str) -> String { | 167 | pub fn fmt_download_uploaded(url: &str) -> String { |
| 168 | format!("pobioron i wysyłon: {url}") | 168 | format!("pobioron i wysyłon: `{url}`") |
| 169 | } | 169 | } |
| 170 | pub fn fmt_upload_summary(count: usize) -> String { | 170 | pub fn fmt_upload_summary(count: usize) -> String { |
| 171 | format!("Wysłano {count} plików:\n") | 171 | format!("Wysłano `{count}` plików:\n") |
| 172 | } | 172 | } |
| 173 | pub fn fmt_upload_partial_failed(count: usize) -> String { | 173 | pub fn fmt_upload_partial_failed(count: usize) -> String { |
| 174 | format!("\n\nNie wysłano {count} plików") | 174 | format!("\n\nNie wysłano `{count}` plików") |
| 175 | } | 175 | } |
| 176 | pub fn fmt_message_compressed(made: usize, total: usize) -> String { | 176 | pub fn fmt_message_compressed(made: usize, total: usize) -> String { |
| 177 | format!("Skompresowano {made} z {total} plików:") | 177 | format!("Skompresowano `{made}` z `{total}` plików:") |
| 178 | } | 178 | } |
| 179 | pub fn fmt_search_result(name: &str, url: &str) -> String { | 179 | pub fn fmt_search_result(name: &str, url: &str) -> String { |
| 180 | format!("**{name}**\n{url}") | 180 | format!("**{name}**\n`{url}`") |
| 181 | } | 181 | } |
| 182 | pub fn fmt_download_failed(stderr: &str) -> String { | 182 | pub fn fmt_download_failed(stderr: &str) -> String { |
| 183 | format!( | 183 | format!( |
| 184 | "Pobieranie się nie powiodło: {}", | 184 | "Pobieranie się nie powiodło: `{}`", |
| 185 | translate_ytdlp_stderr(stderr) | 185 | translate_ytdlp_stderr(stderr) |
| 186 | ) | 186 | ) |
| 187 | } | 187 | } |
| 188 | pub fn fmt_ytdlp_err(e: &dyn std::fmt::Display) -> String { | 188 | pub fn fmt_ytdlp_err(e: &dyn std::fmt::Display) -> String { |
| 189 | format!("yt-dlp nie mógło się uruchomić: {e}") | 189 | format!("yt-dlp nie mógło się uruchomić: `{e}`") |
| 190 | } | 190 | } |
| 191 | pub fn fmt_ytdlp_stderr(stderr: &str) -> String { | 191 | pub fn fmt_ytdlp_stderr(stderr: &str) -> String { |
| 192 | translate_ytdlp_stderr(stderr) | 192 | translate_ytdlp_stderr(stderr) |
| @@ -205,11 +205,8 @@ pub fn translate_ytdlp_stderr(stderr: &str) -> String { | |||
| 205 | // YouTube's anti-bot sign-in wall. yt-dlp can't bypass this without | 205 | // YouTube's anti-bot sign-in wall. yt-dlp can't bypass this without |
| 206 | // browser cookies configured on the host — surface that to the user | 206 | // browser cookies configured on the host — surface that to the user |
| 207 | // rather than the cryptic "Sign in to confirm you're not a bot" line. | 207 | // rather than the cryptic "Sign in to confirm you're not a bot" line. |
| 208 | if lower.contains("sign in to confirm you") | 208 | if lower.contains("not a bot") || lower.contains("reloaded") { |
| 209 | || lower.contains("confirm you're not a bot") | 209 | return "jutup uznaje nas za bota i blokuje pobieranie. Spróbuj ponownie ___**NIGDY**___. Spróbuj pobrać z jutup jeszcze raz, to cie powiesze za jaja.".into(); |
| 210 | || lower.contains("confirm you are not a bot") | ||
| 211 | { | ||
| 212 | return "YouTube uznaje nas za bota i blokuje pobieranie. Spróbuj ponownie później albo podaj inny link.".into(); | ||
| 213 | } | 210 | } |
| 214 | 211 | ||
| 215 | // Generic extractor fallback means the URL didn't match any known | 212 | // Generic extractor fallback means the URL didn't match any known |
| @@ -275,12 +272,12 @@ pub fn translate_ytdlp_stderr(stderr: &str) -> String { | |||
| 275 | }) | 272 | }) |
| 276 | .filter(|s| !s.is_empty()) | 273 | .filter(|s| !s.is_empty()) |
| 277 | .unwrap_or(rest); | 274 | .unwrap_or(rest); |
| 278 | return format!("Pobieranie się nie powiodło: {msg}"); | 275 | return format!("Pobieranie się nie powiodło: `{msg}`"); |
| 279 | } | 276 | } |
| 280 | } | 277 | } |
| 281 | for line in stderr.lines() { | 278 | for line in stderr.lines() { |
| 282 | if let Some(rest) = line.strip_prefix("WARNING:") { | 279 | if let Some(rest) = line.strip_prefix("WARNING:") { |
| 283 | return format!("Pobieranie się nie powiodło: {}", rest.trim()); | 280 | return format!("Pobieranie się nie powiodło: `{}`", rest.trim()); |
| 284 | } | 281 | } |
| 285 | } | 282 | } |
| 286 | 283 | ||
| @@ -292,7 +289,7 @@ pub fn translate_ytdlp_stderr(stderr: &str) -> String { | |||
| 292 | pub const L_WEB_NO_RESULTS: &str = "Brak rezultatów"; | 289 | pub const L_WEB_NO_RESULTS: &str = "Brak rezultatów"; |
| 293 | 290 | ||
| 294 | pub fn fmt_web_title(query: &str) -> String { | 291 | pub fn fmt_web_title(query: &str) -> String { |
| 295 | format!("Wyniki wyszukiwania dla: {query}") | 292 | format!("Wyniki wyszukiwania dla: `{query}`") |
| 296 | } | 293 | } |
| 297 | 294 | ||
| 298 | // ── QR command ──────────────────────────────────────────────────────── | 295 | // ── QR command ──────────────────────────────────────────────────────── |
| @@ -309,16 +306,16 @@ pub fn fmt_qr_decoded(text: &str) -> String { | |||
| 309 | pub const L_CP_UPLOAD_NO_URL: &str = "Wysłanie zawiodło, brak URL w odpowiedzi"; | 306 | pub const L_CP_UPLOAD_NO_URL: &str = "Wysłanie zawiodło, brak URL w odpowiedzi"; |
| 310 | 307 | ||
| 311 | pub fn fmt_cp_search_http(status: &dyn std::fmt::Display, snippet: &str) -> String { | 308 | pub fn fmt_cp_search_http(status: &dyn std::fmt::Display, snippet: &str) -> String { |
| 312 | format!("copyparty zwróciło status HTTP {status}: {snippet}") | 309 | format!("copyparty zwróciło status HTTP `{status}`: `{snippet}`") |
| 313 | } | 310 | } |
| 314 | pub fn fmt_cp_invalid_json(e: &dyn std::fmt::Display, snippet: &str) -> String { | 311 | pub fn fmt_cp_invalid_json(e: &dyn std::fmt::Display, snippet: &str) -> String { |
| 315 | format!("copyparty zwróciło nielegalny JSON. ({e}): {snippet}") | 312 | format!("copyparty zwróciło nielegalny JSON. (`{e}`): `{snippet}`") |
| 316 | } | 313 | } |
| 317 | 314 | ||
| 318 | // ── OpenRouter ──────────────────────────────────────────────────────── | 315 | // ── OpenRouter ──────────────────────────────────────────────────────── |
| 319 | 316 | ||
| 320 | pub fn fmt_llm_err(endpoint: &str, status: &dyn std::fmt::Display, text: &str) -> String { | 317 | pub fn fmt_llm_err(endpoint: &str, status: &dyn std::fmt::Display, text: &str) -> String { |
| 321 | format!("Błąd API LLM ({endpoint}). {status}: {text}") | 318 | format!("Błąd API LLM (`{endpoint}`). `{status}`: `{text}`") |
| 322 | } | 319 | } |
| 323 | 320 | ||
| 324 | // ── Voice / audio decoding ──────────────────────────────────────────── | 321 | // ── Voice / audio decoding ──────────────────────────────────────────── |
| @@ -327,19 +324,19 @@ pub const L_VOICE_NO_TRACK: &str = "Brak kawałka"; | |||
| 327 | pub const L_VOICE_NO_CODEC: &str = "Brak parametrów codec'a audio"; | 324 | pub const L_VOICE_NO_CODEC: &str = "Brak parametrów codec'a audio"; |
| 328 | 325 | ||
| 329 | pub fn fmt_voice_remove_failed(e: &dyn std::fmt::Display) -> String { | 326 | pub fn fmt_voice_remove_failed(e: &dyn std::fmt::Display) -> String { |
| 330 | format!("Nie udało się usunąć klienta głosowego: {e}") | 327 | format!("Nie udało się usunąć klienta głosowego: `{e}`") |
| 331 | } | 328 | } |
| 332 | pub fn fmt_voice_probe_failed(e: &dyn std::fmt::Display) -> String { | 329 | pub fn fmt_voice_probe_failed(e: &dyn std::fmt::Display) -> String { |
| 333 | format!("Próbkowanie symphonia zawiodło: {e}") | 330 | format!("Próbkowanie symphonia zawiodło: `{e}`") |
| 334 | } | 331 | } |
| 335 | pub fn fmt_voice_decoder_failed(e: &dyn std::fmt::Display) -> String { | 332 | pub fn fmt_voice_decoder_failed(e: &dyn std::fmt::Display) -> String { |
| 336 | format!("Nie udało się utworzyć dekodera audio: {e}") | 333 | format!("Nie udało się utworzyć dekodera audio: `{e}`") |
| 337 | } | 334 | } |
| 338 | pub fn fmt_voice_ytdlp_launch(e: &dyn std::fmt::Display) -> String { | 335 | pub fn fmt_voice_ytdlp_launch(e: &dyn std::fmt::Display) -> String { |
| 339 | format!("yt-dlp nie mogło się uruchomić: {e}") | 336 | format!("yt-dlp nie mogło się uruchomić: `{e}`") |
| 340 | } | 337 | } |
| 341 | pub fn fmt_voice_ffmpeg_launch(e: &dyn std::fmt::Display) -> String { | 338 | pub fn fmt_voice_ffmpeg_launch(e: &dyn std::fmt::Display) -> String { |
| 342 | format!("ffmpeg nie mogło się uruchomić: {e}") | 339 | format!("ffmpeg nie mogło się uruchomić: `{e}`") |
| 343 | } | 340 | } |
| 344 | 341 | ||
| 345 | // ── Events ──────────────────────────────────────────────────────────── | 342 | // ── Events ──────────────────────────────────────────────────────────── |
| @@ -351,28 +348,28 @@ pub const L_EV_MESSAGE_HANDLER_ERROR: &str = "Błąd ustanawiacza głosu"; | |||
| 351 | // ── Event TTS phrases ───────────────────────────────────────────────── | 348 | // ── Event TTS phrases ───────────────────────────────────────────────── |
| 352 | 349 | ||
| 353 | pub fn fmt_ev_joined(name: &str) -> String { | 350 | pub fn fmt_ev_joined(name: &str) -> String { |
| 354 | format!("{name} sie zespawnił") | 351 | format!("`{name}` sie zespawnił") |
| 355 | } | 352 | } |
| 356 | pub fn fmt_ev_left(name: &str) -> String { | 353 | pub fn fmt_ev_left(name: &str) -> String { |
| 357 | format!("{name} jest chujem") | 354 | format!("`{name}` jest chujem") |
| 358 | } | 355 | } |
| 359 | pub fn fmt_ev_deafened(name: &str) -> String { | 356 | pub fn fmt_ev_deafened(name: &str) -> String { |
| 360 | format!("{name} jest bity przez ojca") | 357 | format!("`{name}` jest bity przez ojca") |
| 361 | } | 358 | } |
| 362 | pub fn fmt_ev_undeafened(name: &str) -> String { | 359 | pub fn fmt_ev_undeafened(name: &str) -> String { |
| 363 | format!("{name} uciekł od ojca") | 360 | format!("`{name}` uciekł od ojca") |
| 364 | } | 361 | } |
| 365 | pub fn fmt_ev_muted(name: &str) -> String { | 362 | pub fn fmt_ev_muted(name: &str) -> String { |
| 366 | format!("{name} idzie robić jajecznice") | 363 | format!("`{name}` idzie robić jajecznice") |
| 367 | } | 364 | } |
| 368 | pub fn fmt_ev_unmuted(name: &str) -> String { | 365 | pub fn fmt_ev_unmuted(name: &str) -> String { |
| 369 | format!("{name} zrobił jajecznice") | 366 | format!("`{name}` zrobił jajecznice") |
| 370 | } | 367 | } |
| 371 | 368 | ||
| 372 | // ── AI assistant (events/message handler) ───────────────────────────── | 369 | // ── AI assistant (events/message handler) ───────────────────────────── |
| 373 | 370 | ||
| 374 | pub const ASSISTANT_SYSTEM_PROMPT: &str = | 371 | pub const ASSISTANT_SYSTEM_PROMPT: &str = |
| 375 | "Jesteś asystentem. Odpowiadasz po polsku, jesteś pomocny, nie używasz emoji."; | 372 | "Jesteś asystentem. Odpowiadasz po polsku, jesteś pomocny."; |
| 376 | 373 | ||
| 377 | // ── Convenience helpers for repeated Error::Custom patterns ──────────── | 374 | // ── Convenience helpers for repeated Error::Custom patterns ──────────── |
| 378 | 375 | ||
