From 659032c71b196003f7d54717ef88662d18f2f322 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Wed, 15 Jan 2025 12:08:54 +0100 Subject: [PATCH 01/15] Remove outdated warning from README and update roadmap items --- README.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README.md b/README.md index 82f395c..c171bae 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,6 @@ A free and open-source Telegram userbot based on Telethon and fully modular. ## ⚠️ Warnings - -> [!WARNING] -> PLEASE NOTE THAT THE USERBOT IS STILL IN BETA STAGE, THIS MEAN THAT BUGS MAY HAPPENS, YOU CAN CONTRIBUTE TO FIX BUGS AND IMPROVE THIS PROJECT - > [!CAUTION] > USE OF USERBOT ON TELEGRAM IS PROHIBITED AND MAY RESULT IN THE BANNING OF YOUR ACCOUNT. WE DO NOT ASSUME ANY RESPONSIBILITY. THIS PROJECT IS FOR EDUCATIONAL PURPOSES ONLY. @@ -44,8 +40,8 @@ We need your help to translate EXEUbot into different languages! If you are flue ## Roadmap -- [x] Multi-Language support (we need translators for other languages) - [ ] Plugins repository (coming soon) +- [ ] Ability to enable/disable a module from the config.ini file ## Contributing From 8777c6d93fadd5f2ab016aa3d2427565f7c5f41a Mon Sep 17 00:00:00 2001 From: Elxes <124086168+Elxes04@users.noreply.github.com> Date: Wed, 15 Jan 2025 12:12:56 +0100 Subject: [PATCH 02/15] Create SECURITY.md --- SECURITY.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1 @@ + From 48989863b7d970f73dfe32c8af2355aa9fc8ee78 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Wed, 15 Jan 2025 17:59:20 +0100 Subject: [PATCH 03/15] Add versioning support: Read userbot version from version.txt and update info command --- .gitignore | 1 - commands/info.py | 5 ++++- version.txt | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 version.txt diff --git a/.gitignore b/.gitignore index 4584d23..92d505b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *.pyc *.ini -*.txt *.session *.log *.pyc diff --git a/commands/info.py b/commands/info.py index 512dea1..752ac2b 100644 --- a/commands/info.py +++ b/commands/info.py @@ -7,6 +7,9 @@ async def system_info(event): try: + with open('../version.txt', 'r') as version_file: + userbot_version = version_file.read().strip() + cpu_usage = psutil.cpu_percent() memory = psutil.virtual_memory() @@ -24,7 +27,7 @@ async def system_info(event): f"{translations.get('kernel')}: {system_info.release}\n" f"{translations.get('python_version')}: {python_version}\n" f"{translations.get('telethon_version')}: {telethon_version}\n" - f"{translations.get('userbot_version')}: Beta 1.20\n" + f"{translations.get('userbot_version')}: {userbot_version}\n" f"{translations.get('cpu_usage')}: {cpu_usage}%\n" f"{translations.get('ram_usage')}: {memory.percent}% ({humanize.naturalsize(memory.used)})\n" f"{translations.get('ram_total')}: {humanize.naturalsize(memory.total)}\n" diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..78c3960 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.50 \ No newline at end of file From 8d5451561e1aa3395f387a4017f9b83be7524410 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Wed, 15 Jan 2025 19:10:51 +0100 Subject: [PATCH 04/15] Refactor version file path handling in system_info command --- commands/info.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/commands/info.py b/commands/info.py index 752ac2b..e3c7975 100644 --- a/commands/info.py +++ b/commands/info.py @@ -2,13 +2,16 @@ import speedtest import platform import humanize +import os from telethon import TelegramClient, events from translations import translations async def system_info(event): try: - with open('../version.txt', 'r') as version_file: - userbot_version = version_file.read().strip() + version_path = os.path.join(os.path.dirname(__file__), "../version.txt") + if os.path.exists(version_path): + with open(version_path, 'r') as version_file: + userbot_version = version_file.read().strip() cpu_usage = psutil.cpu_percent() memory = psutil.virtual_memory() From 9b09f3b208338c2f5d564109af7a06116bd123fd Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Wed, 15 Jan 2025 20:21:52 +0100 Subject: [PATCH 05/15] Updated URL shortening functionality with new translations --- commands/shorten.py | 11 +++++++---- translations/de.json | 7 +++++-- translations/en.json | 7 +++++-- translations/es.json | 7 +++++-- translations/fr.json | 7 +++++-- translations/it.json | 6 +++++- translations/pl.json | 7 +++++-- translations/ru.json | 7 +++++-- translations/uk.json | 7 +++++-- 9 files changed, 47 insertions(+), 19 deletions(-) diff --git a/commands/shorten.py b/commands/shorten.py index a6c0825..3741ab9 100644 --- a/commands/shorten.py +++ b/commands/shorten.py @@ -1,6 +1,9 @@ from telethon import TelegramClient, events import requests import re +import json +import os +from translations import translations async def shorten_url(event): @@ -14,13 +17,13 @@ async def shorten_url(event): response = requests.get(api_url) if response.status_code == 200: shortened_url = response.text - await event.edit(f"URL shortened with TinyURL: {shortened_url}") + await event.edit(translations["url_shortened"].format(shortened_url=shortened_url)) else: - await event.reply("An error occurred while shortening the URL.") + await event.reply(translations["error_shortening_url"]) except Exception as e: - await event.reply(f"An error occurred: {str(e)}") + await event.reply(translations["error_occurred"].format(error=str(e))) else: - await event.reply("Please provide a URL to shorten.") + await event.reply(translations["provide_url_to_shorten"]) def register(client): @client.on(events.NewMessage(pattern=r'^\.short\s+\S+', outgoing=True)) diff --git a/translations/de.json b/translations/de.json index afb055d..763a033 100644 --- a/translations/de.json +++ b/translations/de.json @@ -68,6 +68,9 @@ "// timer.py": "Übersetzungen für timer.py", "timer_started": "⏳ Timer gestartet: {reason}\nVerbleibend: {countdown_time} Sekunden.", "timer_running": "⏳ Timer gestartet: {reason}\nVerbleibend: {time_display}", - "timer_finished": "✅ Timer beendet: {reason}!" - + "timer_finished": "✅ Timer beendet: {reason}!", + "// shorten.py": "Übersetzungen für shorten.py", + "url_shortened": "URL mit TinyURL verkürzt: {shortened_url}", + "error_shortening_url": "Beim Verkürzen der URL ist ein Fehler aufgetreten.", + "provide_url_to_shorten": "Bitte geben Sie eine URL zum Verkürzen an." } diff --git a/translations/en.json b/translations/en.json index 69c2edb..b0a6019 100644 --- a/translations/en.json +++ b/translations/en.json @@ -68,6 +68,9 @@ "// timer.py": "Translations for timer.py", "timer_started": "⏳ Timer started: {reason}\nRemaining: {countdown_time} seconds.", "timer_running": "⏳ Timer started: {reason}\nRemaining: {time_display}", - "timer_finished": "✅ Timer finished: {reason}!" - + "timer_finished": "✅ Timer finished: {reason}!", + "// shorten.py": "Translations for shorten.py", + "url_shortened": "URL shortened with TinyURL: {shortened_url}", + "error_shortening_url": "An error occurred while shortening the URL.", + "provide_url_to_shorten": "Please provide a URL to shorten." } diff --git a/translations/es.json b/translations/es.json index 5658396..0da6c9d 100644 --- a/translations/es.json +++ b/translations/es.json @@ -68,6 +68,9 @@ "// timer.py": "Traducciones para timer.py", "timer_started": "⏳ Temporizador iniciado: {reason}\nQuedan: {countdown_time} segundos.", "timer_running": "⏳ Temporizador iniciado: {reason}\nQuedan: {time_display}", - "timer_finished": "✅ Temporizador finalizado: {reason}!" - + "timer_finished": "✅ Temporizador finalizado: {reason}!", + "// shorten.py": "Traducciones para shorten.py", + "url_shortened": "URL acortada con TinyURL: {shortened_url}", + "error_shortening_url": "Ocurrió un error al acortar la URL.", + "provide_url_to_shorten": "Por favor, proporciona una URL para acortar." } diff --git a/translations/fr.json b/translations/fr.json index 6f0138b..f4bd489 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -68,6 +68,9 @@ "// timer.py": "Traductions pour timer.py", "timer_started": "⏳ Minuteur démarré : {reason}\nRestant : {countdown_time} secondes.", "timer_running": "⏳ Minuteur démarré : {reason}\nRestant : {time_display}", - "timer_finished": "✅ Minuteur terminé : {reason}!" - + "timer_finished": "✅ Minuteur terminé : {reason}!", + "// shorten.py": "Traductions pour shorten.py", + "url_shortened": "URL raccourcie avec TinyURL: {shortened_url}", + "error_shortening_url": "Une erreur s'est produite lors du raccourcissement de l'URL.", + "provide_url_to_shorten": "Veuillez fournir une URL à raccourcir." } diff --git a/translations/it.json b/translations/it.json index 1342875..f4445d9 100644 --- a/translations/it.json +++ b/translations/it.json @@ -68,5 +68,9 @@ "// timer.py": "Traduzioni per timer.py", "timer_started": "⏳ Timer avviato: {reason}\nRimanenti: {countdown_time} secondi.", "timer_running": "⏳ Timer avviato: {reason}\nRimanenti: {time_display}", - "timer_finished": "✅ Timer terminato: {reason}!" + "timer_finished": "✅ Timer terminato: {reason}!", + "// shorten.py": "Traduzioni per shorten.py", + "url_shortened": "URL accorciato con TinyURL: {shortened_url}", + "error_shortening_url": "Si è verificato un errore durante l'accorciamento dell'URL.", + "provide_url_to_shorten": "Per favore, fornisci un URL da accorciare." } diff --git a/translations/pl.json b/translations/pl.json index 9c709ab..80448da 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -68,6 +68,9 @@ "// timer.py": "Tłumaczenia dla timer.py", "timer_started": "⏳ Timer uruchomiony: {reason}\nPozostało: {countdown_time} sekund.", "timer_running": "⏳ Timer uruchomiony: {reason}\nPozostało: {time_display}", - "timer_finished": "✅ Timer zakończony: {reason}!" - + "timer_finished": "✅ Timer zakończony: {reason}!", + "// shorten.py": "Tłumaczenia dla shorten.py", + "url_shortened": "URL skrócony za pomocą TinyURL: {shortened_url}", + "error_shortening_url": "Wystąpił błąd podczas skracania URL.", + "provide_url_to_shorten": "Proszę podać URL do skrócenia." } diff --git a/translations/ru.json b/translations/ru.json index 9310da9..2f2abd1 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -68,6 +68,9 @@ "// timer.py": "Переводы для timer.py", "timer_started": "⏳ Таймер запущен: {reason}\nОсталось: {countdown_time} секунд.", "timer_running": "⏳ Таймер запущен: {reason}\nОсталось: {time_display}", - "timer_finished": "✅ Таймер завершён: {reason}!" - + "timer_finished": "✅ Таймер завершён: {reason}!", + "// shorten.py": "Переводы для shorten.py", + "url_shortened": "URL сокращен с помощью TinyURL: {shortened_url}", + "error_shortening_url": "Произошла ошибка при сокращении URL.", + "provide_url_to_shorten": "Пожалуйста, укажите URL для сокращения." } diff --git a/translations/uk.json b/translations/uk.json index d24d78b..ea31bf9 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -68,6 +68,9 @@ "// timer.py": "Переклади для timer.py", "timer_started": "⏳ Таймер запущено: {reason}\nЗалишилось: {countdown_time} секунд.", "timer_running": "⏳ Таймер запущено: {reason}\nЗалишилось: {time_display}", - "timer_finished": "✅ Таймер завершено: {reason}!" - + "timer_finished": "✅ Таймер завершено: {reason}!", + "// shorten.py": "Переклади для shorten.py", + "url_shortened": "URL скорочено за допомогою TinyURL: {shortened_url}", + "error_shortening_url": "Під час скорочення URL сталася помилка.", + "provide_url_to_shorten": "Будь ласка, надайте URL для скорочення." } From d1fa16da4847827a12236d923fd629ee9bcf9938 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Wed, 15 Jan 2025 21:22:41 +0100 Subject: [PATCH 06/15] Remove commented translation entries from language files --- translations/de.json | 14 -------------- translations/en.json | 14 -------------- translations/es.json | 14 -------------- translations/fr.json | 14 -------------- translations/it.json | 14 -------------- translations/pl.json | 14 -------------- translations/ru.json | 14 -------------- translations/uk.json | 14 -------------- 8 files changed, 112 deletions(-) diff --git a/translations/de.json b/translations/de.json index 763a033..2642498 100644 --- a/translations/de.json +++ b/translations/de.json @@ -1,12 +1,10 @@ { - "// whitelist.py": "Übersetzungen für whitelist.py", "user_whitelisted": "Der Benutzer {user_id} ist bereits auf der Whitelist.", "user_added_whitelist": "Benutzer {user_id} zur Whitelist hinzugefügt.", "user_not_in_whitelist": "Der Benutzer {user_id} ist nicht auf der Whitelist.", "user_removed_whitelist": "Benutzer {user_id} von der Whitelist entfernt.", "blocked_reported": "Du wurdest blockiert und wegen Spam gemeldet.", "warning_message": "Warnung {current_warning}/{warning_count}: Du kannst diesen Benutzer nicht kontaktieren. Bitte höre auf, Nachrichten zu senden, sonst wirst du blockiert.", - "// infouser.py": "Übersetzungen für infouser.py", "command_in_groups_only": "Dieser Befehl funktioniert nur in Gruppen.", "mention_or_reply_user": "Du musst auf die Nachricht eines Benutzers antworten oder den Benutzer erwähnen, um diesen Befehl zu verwenden.", "about_user": "Informationen über {first_name}:", @@ -14,28 +12,21 @@ "user_name": "Name: {first_name} {last_name}", "user_username": "Benutzername: @{username}", "user_datacenter": "Rechenzentrum: {datacenter}", - "// leave.py": "Übersetzungen für leave.py", "left_group": "Ich habe die Gruppe verlassen.", "command_groups_only": "Dieser Befehl kann nur in Gruppen verwendet werden.", - "// main.py": "Übersetzungen für main.py", "userbot_started": "Userbot gestartet!", "userbot_disconnected_cancelled_error": "Userbot wegen einer CancelledError-Ausnahme getrennt.", "error_occurred": "Ein Fehler ist aufgetreten: {error}", "abort_signal_received": "Abbruchsignal erhalten. Userbot wird geschlossen…", - "// video_downloader.py": "Übersetzungen für video_downloader.py", "video": "Video: '{video_title}'", "video_downloaded_successfully": "Video '{video_title}' erfolgreich heruntergeladen! Senden…", "error_downloading_video": "Fehler beim Herunterladen des Videos: {error}", - "// copy.py": "Übersetzungen für copy.py", "copy_successfully": "Konto erfolgreich geklont", - "// dellog.py": "Übersetzungen für dellog.py", "dellog_successfully": "Die Protokolldatei wurde erfolgreich gelöscht.", "dellog_missing": "Die Protokolldatei fehlt.", - "// dm.py": "Übersetzungen für dm.py", "provide_username_dm": "Bitte gib einen Benutzernamen und eine Nachricht an.", "user_not_found": "Benutzer nicht gefunden, bitte gib einen gültigen Benutzernamen an.", "message_sent": "Nachricht an @{username} gesendet!", - "// info.py": "Übersetzungen für info.py", "system_info_title": "ℹ️ Systeminformationen:", "os": "💻 OS", "kernel": "🔳 Kernel", @@ -48,15 +39,12 @@ "ping": "📶 Ping", "userbot_commands_link": "🤖 [Userbot-Befehle](https://telegra.ph/Userbot-commands-09-11-46)", "userbot_created_by": "👤 Userbot erstellt von Elxes ©️", - "// delall.py": "Übersetzungen für delall.py", "floodwait_error": "Das Konto ist im Floodwait. Warte {waitingtime} Sekunden…", - "// backup.py": "Übersetzungen für backup.py", "backup_complete": "Informationssicherung abgeschlossen!", "backup_error": "Beim Sichern ist ein Fehler aufgetreten: {error}", "no_backup_files": "Keine Sicherungsdateien gefunden.", "restore_complete": "Wiederherstellung abgeschlossen!", "restore_error": "Beim Wiederherstellen ist ein Fehler aufgetreten: {error}", - "// weather.py": "Übersetzungen für weather.py", "ask_city": "Bitte geben Sie den Namen einer Stadt an.", "city_not_found": "Stadt nicht gefunden, bitte überprüfen Sie den Namen und versuchen Sie es erneut.", "weather_in": "Wetter in", @@ -65,11 +53,9 @@ "wind_speed": "🌬️ Windgeschwindigkeit", "description": "🔍 Beschreibung", "pressure": "🔵 Druck", - "// timer.py": "Übersetzungen für timer.py", "timer_started": "⏳ Timer gestartet: {reason}\nVerbleibend: {countdown_time} Sekunden.", "timer_running": "⏳ Timer gestartet: {reason}\nVerbleibend: {time_display}", "timer_finished": "✅ Timer beendet: {reason}!", - "// shorten.py": "Übersetzungen für shorten.py", "url_shortened": "URL mit TinyURL verkürzt: {shortened_url}", "error_shortening_url": "Beim Verkürzen der URL ist ein Fehler aufgetreten.", "provide_url_to_shorten": "Bitte geben Sie eine URL zum Verkürzen an." diff --git a/translations/en.json b/translations/en.json index b0a6019..0a24744 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1,12 +1,10 @@ { - "// whitelist.py": "Translations for whitelist.py", "user_whitelisted": "User {user_id} is already in the whitelist.", "user_added_whitelist": "User {user_id} added to whitelist.", "user_not_in_whitelist": "User {user_id} is not in the whitelist.", "user_removed_whitelist": "User {user_id} removed from whitelist.", "blocked_reported": "You have been blocked and reported for spamming.", "warning_message": "Warning {current_warning}/{warning_count}: You can't contact this user. Please stop sending messages, otherwise you'll get blocked.", - "// infouser.py": "Translations for infouser.py", "command_in_groups_only": "This command only works in groups.", "mention_or_reply_user": "You must reply to a user's message or mention the user to use this command.", "about_user": "About {first_name}:", @@ -14,28 +12,21 @@ "user_name": "Name: {first_name} {last_name}", "user_username": "Username: @{username}", "user_datacenter": "Datacenter: {datacenter}", - "// leave.py": "Translations for leave.py", "left_group": "I left the group.", "command_groups_only": "This command can only be used in groups.", - "// main.py": "Translations for main.py", "userbot_started": "Userbot started!", "userbot_disconnected_cancelled_error": "Userbot disconnected due to a CancelledError exception.", "error_occurred": "An error occurred: {error}", "abort_signal_received": "Abort signal received. Closing the Userbot…", - "// video_downloader.py": "Translations for video_downloader.py", "video": "Video: '{video_title}'", "video_downloaded_successfully": "Video '{video_title}' downloaded successfully! Sending…", "error_downloading_video": "Error downloading video: {error}", - "// copy.py": "Translations for copy.py", "copy_successfully": "Account successfully cloned", - "// dellog.py": "Translations for dellog.py", "dellog_successfully": "The log file has been successfully deleted.", "dellog_missing": "The log file is missing.", - "// dm.py": "Translations for dm.py", "provide_username_dm": "Please, provide a username and a message.", "user_not_found": "Failed to find a user. Please provide a valid username.", "message_sent": "Message sent to @{username}!", - "// info.py": "Translations for info.py", "system_info_title": "ℹ️ System info:", "os": "💻 OS", "kernel": "🔳 Kernel", @@ -48,15 +39,12 @@ "ping": "📶 Ping", "userbot_commands_link": "🤖 [Userbot Commands](https://telegra.ph/Userbot-commands-09-11-46)", "userbot_created_by": "👤 Userbot created by Elxes ©️", - "// delall.py": "Translations for delall.py", "floodwait_error": "Account is in floodwait. Waiting for {waitingtime} seconds…", - "// backup.py": "Translations for backup.py", "backup_complete": "Information backup complete!", "backup_error": "An error occurred during backup: {error}", "no_backup_files": "No backup files found.", "restore_complete": "Restore complete!", "restore_error": "An error occurred while restoring: {error}", - "// weather.py": "Translations for weather.py", "ask_city": "Please specify a city name.", "city_not_found": "City not found, please check the name and try again.", "weather_in": "Weather in", @@ -65,11 +53,9 @@ "wind_speed": "🌬️ Wind Speed", "description": "🔍 Description", "pressure": "🔵 Pressure", - "// timer.py": "Translations for timer.py", "timer_started": "⏳ Timer started: {reason}\nRemaining: {countdown_time} seconds.", "timer_running": "⏳ Timer started: {reason}\nRemaining: {time_display}", "timer_finished": "✅ Timer finished: {reason}!", - "// shorten.py": "Translations for shorten.py", "url_shortened": "URL shortened with TinyURL: {shortened_url}", "error_shortening_url": "An error occurred while shortening the URL.", "provide_url_to_shorten": "Please provide a URL to shorten." diff --git a/translations/es.json b/translations/es.json index 0da6c9d..eec9add 100644 --- a/translations/es.json +++ b/translations/es.json @@ -1,12 +1,10 @@ { - "// whitelist.py": "Traducciones para whitelist.py", "user_whitelisted": "El usuario {user_id} ya está en la lista blanca.", "user_added_whitelist": "Usuario {user_id} añadido a la lista blanca.", "user_not_in_whitelist": "El usuario {user_id} no está en la lista blanca.", "user_removed_whitelist": "Usuario {user_id} eliminado de la lista blanca.", "blocked_reported": "Has sido bloqueado y reportado por spam.", "warning_message": "Advertencia {current_warning}/{warning_count}: No puedes contactar a este usuario. Por favor, deja de enviar mensajes, de lo contrario serás bloqueado.", - "// infouser.py": "Traducciones para infouser.py", "command_in_groups_only": "Este comando solo funciona en grupos.", "mention_or_reply_user": "Debes responder al mensaje de un usuario o mencionar al usuario para usar este comando.", "about_user": "Información sobre {first_name}:", @@ -14,28 +12,21 @@ "user_name": "Nombre: {first_name} {last_name}", "user_username": "Username: @{username}", "user_datacenter": "Datacenter: {datacenter}", - "// leave.py": "Traducciones para leave.py", "left_group": "He dejado el grupo.", "command_groups_only": "Este comando solo se puede usar en grupos.", - "// main.py": "Traducciones para main.py", "userbot_started": "¡Userbot iniciado!", "userbot_disconnected_cancelled_error": "Userbot desconectado debido a una excepción CancelledError.", "error_occurred": "Ocurrió un error: {error}", "abort_signal_received": "Señal de interrupción recibida. Cerrando el Userbot…", - "// video_downloader.py": "Traducciones para video_downloader.py", "video": "Video: '{video_title}'", "video_downloaded_successfully": "¡Video '{video_title}' descargado con éxito! Enviando…", "error_downloading_video": "Error al descargar el video: {error}", - "// copy.py": "Traducciones para copy.py", "copy_successfully": "Cuenta clonada con éxito", - "// dellog.py": "Traducciones para dellog.py", "dellog_successfully": "El archivo de log se ha eliminado correctamente.", "dellog_missing": "El archivo de log está desaparecido.", - "// dm.py": "Traducciones para dm.py", "provide_username_dm": "Por favor, proporciona un nombre de usuario y un mensaje.", "user_not_found": "Usuario no encontrado, por favor, proporciona un nombre de usuario válido.", "message_sent": "¡Mensaje enviado a @{username}!", - "// info.py": "Traducciones para info.py", "system_info_title": "ℹ️ Información del sistema:", "os": "💻 OS", "kernel": "🔳 Kernel", @@ -48,15 +39,12 @@ "ping": "📶 Ping", "userbot_commands_link": "🤖 [Comandos de Userbot](https://telegra.ph/Userbot-commands-09-11-46)", "userbot_created_by": "👤 Userbot creado por Elxes ©️", - "// delall.py": "Traducciones para delall.py", "floodwait_error": "La cuenta está en floodwait. Esperando {waitingtime} segundos…", - "// backup.py": "Traducciones para backup.py", "backup_complete": "¡Copia de seguridad de la información completada!", "backup_error": "Ocurrió un error durante la copia de seguridad: {error}", "no_backup_files": "No se encontraron archivos de copia de seguridad.", "restore_complete": "¡Restauración completada!", "restore_error": "Ocurrió un error durante la restauración: {error}", - "// weather.py": "Traducciones para weather.py", "ask_city": "Por favor, especifica el nombre de una ciudad.", "city_not_found": "Ciudad no encontrada, por favor verifica el nombre e intenta nuevamente.", "weather_in": "El tiempo en", @@ -65,11 +53,9 @@ "wind_speed": "🌬️ Velocidad del viento", "description": "🔍 Descripción", "pressure": "🔵 Presión", - "// timer.py": "Traducciones para timer.py", "timer_started": "⏳ Temporizador iniciado: {reason}\nQuedan: {countdown_time} segundos.", "timer_running": "⏳ Temporizador iniciado: {reason}\nQuedan: {time_display}", "timer_finished": "✅ Temporizador finalizado: {reason}!", - "// shorten.py": "Traducciones para shorten.py", "url_shortened": "URL acortada con TinyURL: {shortened_url}", "error_shortening_url": "Ocurrió un error al acortar la URL.", "provide_url_to_shorten": "Por favor, proporciona una URL para acortar." diff --git a/translations/fr.json b/translations/fr.json index f4bd489..dc1a635 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -1,12 +1,10 @@ { - "// whitelist.py": "Traductions pour whitelist.py", "user_whitelisted": "L'utilisateur {user_id} est déjà sur la liste blanche.", "user_added_whitelist": "Utilisateur {user_id} ajouté à la liste blanche.", "user_not_in_whitelist": "L'utilisateur {user_id} n'est pas sur la liste blanche.", "user_removed_whitelist": "Utilisateur {user_id} retiré de la liste blanche.", "blocked_reported": "Vous avez été bloqué et signalé pour spam.", "warning_message": "Avertissement {current_warning}/{warning_count} : Vous ne pouvez pas contacter cet utilisateur. Veuillez cesser d'envoyer des messages, sinon vous serez bloqué.", - "// infouser.py": "Traductions pour infouser.py", "command_in_groups_only": "Cette commande fonctionne uniquement dans les groupes.", "mention_or_reply_user": "Vous devez répondre au message d'un utilisateur ou mentionner l'utilisateur pour utiliser cette commande.", "about_user": "Informations sur {first_name} :", @@ -14,28 +12,21 @@ "user_name": "Nom : {first_name} {last_name}", "user_username": "Nom d'utilisateur : @{username}", "user_datacenter": "Datacenter : {datacenter}", - "// leave.py": "Traductions pour leave.py", "left_group": "J'ai quitté le groupe.", "command_groups_only": "Cette commande ne peut être utilisée que dans les groupes.", - "// main.py": "Traductions pour main.py", "userbot_started": "Userbot démarré !", "userbot_disconnected_cancelled_error": "Userbot déconnecté en raison d'une exception CancelledError.", "error_occurred": "Une erreur s'est produite : {error}", "abort_signal_received": "Signal d'interruption reçu. Fermeture de l'Userbot…", - "// video_downloader.py": "Traductions pour video_downloader.py", "video": "Vidéo : '{video_title}'", "video_downloaded_successfully": "Vidéo '{video_title}' téléchargée avec succès ! Envoi…", "error_downloading_video": "Erreur lors du téléchargement de la vidéo : {error}", - "// copy.py": "Traductions pour copy.py", "copy_successfully": "Compte cloné avec succès", - "// dellog.py": "Traductions pour dellog.py", "dellog_successfully": "Le fichier de log a été supprimé avec succès.", "dellog_missing": "Le fichier de log est manquant.", - "// dm.py": "Traductions pour dm.py", "provide_username_dm": "Veuillez fournir un nom d'utilisateur et un message.", "user_not_found": "Utilisateur non trouvé, veuillez fournir un nom d'utilisateur valide.", "message_sent": "Message envoyé à @{username} !", - "// info.py": "Traductions pour info.py", "system_info_title": "ℹ️ Informations système:", "os": "💻 OS", "kernel": "🔳 Noyau", @@ -48,15 +39,12 @@ "ping": "📶 Ping", "userbot_commands_link": "🤖 [Commandes Userbot](https://telegra.ph/Userbot-commands-09-11-46)", "userbot_created_by": "👤 Userbot créé par Elxes ©️", - "// delall.py": "Traductions pour delall.py", "floodwait_error": "Le compte est en attente de floodwait. Attente de {waitingtime} secondes…", - "// backup.py": "Traductions pour backup.py", "backup_complete": "Sauvegarde des informations terminée!", "backup_error": "Une erreur s'est produite lors de la sauvegarde: {error}", "no_backup_files": "Aucun fichier de sauvegarde trouvé.", "restore_complete": "Restauration terminée!", "restore_error": "Une erreur s'est produite lors de la restauration: {error}", - "// weather.py": "Traductions pour weather.py", "ask_city": "Veuillez préciser le nom d'une ville.", "city_not_found": "Ville introuvable, veuillez vérifier le nom et réessayer.", "weather_in": "Météo à", @@ -65,11 +53,9 @@ "wind_speed": "🌬️ Vitesse du vent", "description": "🔍 Description", "pressure": "🔵 Pression", - "// timer.py": "Traductions pour timer.py", "timer_started": "⏳ Minuteur démarré : {reason}\nRestant : {countdown_time} secondes.", "timer_running": "⏳ Minuteur démarré : {reason}\nRestant : {time_display}", "timer_finished": "✅ Minuteur terminé : {reason}!", - "// shorten.py": "Traductions pour shorten.py", "url_shortened": "URL raccourcie avec TinyURL: {shortened_url}", "error_shortening_url": "Une erreur s'est produite lors du raccourcissement de l'URL.", "provide_url_to_shorten": "Veuillez fournir une URL à raccourcir." diff --git a/translations/it.json b/translations/it.json index f4445d9..8329d62 100644 --- a/translations/it.json +++ b/translations/it.json @@ -1,12 +1,10 @@ { - "// whitelist.py": "Traduzioni per whitelist.py", "user_whitelisted": "L'utente {user_id} è già nella whitelist.", "user_added_whitelist": "Utente {user_id} aggiunto alla whitelist.", "user_not_in_whitelist": "L'utente {user_id} non è nella whitelist.", "user_removed_whitelist": "Utente {user_id} rimosso dalla whitelist.", "blocked_reported": "Sei stato bloccato e segnalato per spam.", "warning_message": "Avvertimento {current_warning}/{warning_count}: Non puoi contattare questo utente. Per favore, smetti di inviare messaggi, altrimenti sarai bloccato.", - "// infouser.py": "Traduzioni per infouser.py", "command_in_groups_only": "Questo comando funziona solo nei gruppi.", "mention_or_reply_user": "Devi rispondere al messaggio di un utente o menzionare l'utente per usare questo comando.", "about_user": "Informazioni su {first_name}:", @@ -14,28 +12,21 @@ "user_name": "Nome: {first_name} {last_name}", "user_username": "Username: @{username}", "user_datacenter": "Datacenter: {datacenter}", - "// leave.py": "Traduzioni per leave.py", "left_group": "Ho lasciato il gruppo.", "command_groups_only": "Questo comando può essere usato solo nei gruppi.", - "// main.py": "Traduzioni per main.py", "userbot_started": "Userbot avviato!", "userbot_disconnected_cancelled_error": "Userbot disconnesso a causa di un'eccezione CancelledError.", "error_occurred": "Si è verificato un errore: {error}", "abort_signal_received": "Segnale di interruzione ricevuto. Chiusura del Userbot…", - "// video_downloader.py": "Traduzioni per video_downloader.py", "video": "Video: '{video_title}'", "video_downloaded_successfully": "Video '{video_title}' scaricato con successo! Invio…", "error_downloading_video": "Errore nel download del video: {error}", - "// copy.py": "Traduzioni per copy.py", "copy_successfully": "Account clonato con successo", - "// dellog.py": "Traduzioni per dellog.py", "dellog_successfully": "Il file di log è stato eliminato correttamente.", "dellog_missing": "Il file di log è mancante.", - "// dm.py": "Traduzioni per dm.py", "provide_username_dm": "Per favore, fornisci un username e un messaggio.", "user_not_found": "Utente non trovato, per favore, fornisci uno username valido.", "message_sent": "Messaggio inviato a @{username}!", - "// info.py": "Traduzioni per info.py", "system_info_title": "ℹ️ Informazioni di sistema:", "os": "💻 OS", "kernel": "🔳 Kernel", @@ -48,15 +39,12 @@ "ping": "📶 Ping", "userbot_commands_link": "🤖 [Comandi Userbot](https://telegra.ph/Userbot-commands-09-11-46)", "userbot_created_by": "👤 Userbot creato da Elxes ©️", - "// delall.py": "Traduzioni per delall.py", "floodwait_error": "L'account è in floodwait. Attendere {waitingtime} secondi…", - "// backup.py": "Traduzioni per backup.py", "backup_complete": "Backup delle informazioni completato!", "backup_error": "Si è verificato un errore durante il backup: {error}", "no_backup_files": "Nessun file di backup trovato.", "restore_complete": "Ripristino completato!", "restore_error": "Si è verificato un errore durante il ripristino: {error}", - "// weather.py": "Traduzioni per weather.py", "ask_city": "Per favore, specifica il nome di una città.", "city_not_found": "Città non trovata, controlla il nome e riprova.", "weather_in": "Meteo a", @@ -65,11 +53,9 @@ "wind_speed": "🌬️ Velocità del vento", "description": "🔍 Descrizione", "pressure": "🔵 Pressione", - "// timer.py": "Traduzioni per timer.py", "timer_started": "⏳ Timer avviato: {reason}\nRimanenti: {countdown_time} secondi.", "timer_running": "⏳ Timer avviato: {reason}\nRimanenti: {time_display}", "timer_finished": "✅ Timer terminato: {reason}!", - "// shorten.py": "Traduzioni per shorten.py", "url_shortened": "URL accorciato con TinyURL: {shortened_url}", "error_shortening_url": "Si è verificato un errore durante l'accorciamento dell'URL.", "provide_url_to_shorten": "Per favore, fornisci un URL da accorciare." diff --git a/translations/pl.json b/translations/pl.json index 80448da..9d6635d 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -1,12 +1,10 @@ { - "// whitelist.py": "Tłumaczenia dla whitelist.py", "user_whitelisted": "Użytkownik {user_id} jest już na białej liście.", "user_added_whitelist": "Użytkownik {user_id} dodany do białej listy.", "user_not_in_whitelist": "Użytkownik {user_id} nie jest na białej liście.", "user_removed_whitelist": "Użytkownik {user_id} usunięty z białej listy.", "blocked_reported": "Zostałeś zablokowany i zgłoszony za spam.", "warning_message": "Ostrzeżenie {current_warning}/{warning_count}: Nie możesz kontaktować się z tym użytkownikiem. Proszę, przestań wysyłać wiadomości, w przeciwnym razie zostaniesz zablokowany.", - "// infouser.py": "Tłumaczenia dla infouser.py", "command_in_groups_only": "To polecenie działa tylko w grupach.", "mention_or_reply_user": "Musisz odpowiedzieć na wiadomość użytkownika lub wspomnieć użytkownika, aby użyć tego polecenia.", "about_user": "Informacje o {first_name}:", @@ -14,28 +12,21 @@ "user_name": "Imię: {first_name} {last_name}", "user_username": "Nazwa użytkownika: @{username}", "user_datacenter": "Centrum danych: {datacenter}", - "// leave.py": "Tłumaczenia dla leave.py", "left_group": "Opuściłem grupę.", "command_groups_only": "To polecenie może być używane tylko w grupach.", - "// main.py": "Tłumaczenia dla main.py", "userbot_started": "Userbot uruchomiony!", "userbot_disconnected_cancelled_error": "Userbot został rozłączony z powodu wyjątku CancelledError.", "error_occurred": "Wystąpił błąd: {error}", "abort_signal_received": "Odebrano sygnał przerwania. Zamykam Userbota…", - "// video_downloader.py": "Tłumaczenia dla video_downloader.py", "video": "Wideo: '{video_title}'", "video_downloaded_successfully": "Wideo '{video_title}' pobrano pomyślnie! Wysyłanie…", "error_downloading_video": "Błąd podczas pobierania wideo: {error}", - "// copy.py": "Tłumaczenia dla copy.py", "copy_successfully": "Konto sklonowane pomyślnie", - "// dellog.py": "Tłumaczenia dla dellog.py", "dellog_successfully": "Plik dziennika został pomyślnie usunięty.", "dellog_missing": "Brak pliku dziennika.", - "// dm.py": "Tłumaczenia dla dm.py", "provide_username_dm": "Proszę podać nazwę użytkownika i wiadomość.", "user_not_found": "Nie znaleziono użytkownika, proszę podać prawidłową nazwę użytkownika.", "message_sent": "Wiadomość wysłana do @{username}!", - "// info.py": "Tłumaczenia dla info.py", "system_info_title": "ℹ️ Informacje o systemie:", "os": "💻 OS", "kernel": "🔳 Jądro", @@ -48,15 +39,12 @@ "ping": "📶 Ping", "userbot_commands_link": "🤖 [Komendy Userbot](https://telegra.ph/Userbot-commands-09-11-46)", "userbot_created_by": "👤 Userbot stworzony przez Elxes ©️", - "// delall.py": "Tłumaczenia dla delall.py", "floodwait_error": "Konto jest w trybie floodwait. Czekaj {waitingtime} sekund…", - "// backup.py": "Tłumaczenia dla backup.py", "backup_complete": "Kopia zapasowa informacji zakończona!", "backup_error": "Wystąpił błąd podczas tworzenia kopii zapasowej: {error}", "no_backup_files": "Nie znaleziono plików kopii zapasowej.", "restore_complete": "Przywracanie zakończone!", "restore_error": "Wystąpił błąd podczas przywracania: {error}", - "// weather.py": "Tłumaczenia dla weather.py", "ask_city": "Proszę podać nazwę miasta.", "city_not_found": "Nie znaleziono miasta, sprawdź nazwę i spróbuj ponownie.", "weather_in": "Pogoda w", @@ -65,11 +53,9 @@ "wind_speed": "🌬️ Prędkość wiatru", "description": "🔍 Opis", "pressure": "🔵 Ciśnienie", - "// timer.py": "Tłumaczenia dla timer.py", "timer_started": "⏳ Timer uruchomiony: {reason}\nPozostało: {countdown_time} sekund.", "timer_running": "⏳ Timer uruchomiony: {reason}\nPozostało: {time_display}", "timer_finished": "✅ Timer zakończony: {reason}!", - "// shorten.py": "Tłumaczenia dla shorten.py", "url_shortened": "URL skrócony za pomocą TinyURL: {shortened_url}", "error_shortening_url": "Wystąpił błąd podczas skracania URL.", "provide_url_to_shorten": "Proszę podać URL do skrócenia." diff --git a/translations/ru.json b/translations/ru.json index 2f2abd1..c390633 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -1,12 +1,10 @@ { - "// whitelist.py": "Переводы для whitelist.py", "user_whitelisted": "Пользователь {user_id} уже в белом списке.", "user_added_whitelist": "Пользователь {user_id} добавлен в белый список.", "user_not_in_whitelist": "Пользователь {user_id} не в белом списке.", "user_removed_whitelist": "Пользователь {user_id} удален из белого списка.", "blocked_reported": "Вы были заблокированы и сообщены за спам.", "warning_message": "Предупреждение {current_warning}/{warning_count}: Вы не можете связаться с этим пользователем. Пожалуйста, прекратите отправлять сообщения, иначе вы будете заблокированы.", - "// infouser.py": "Переводы для infouser.py", "command_in_groups_only": "Эта команда работает только в группах.", "mention_or_reply_user": "Вы должны ответить на сообщение пользователя или упомянуть пользователя, чтобы использовать эту команду.", "about_user": "О {first_name}:", @@ -14,28 +12,21 @@ "user_name": "Имя: {first_name} {last_name}", "user_username": "Имя пользователя: @{username}", "user_datacenter": "Датацентр: {datacenter}", - "// leave.py": "Переводы для leave.py", "left_group": "Я покинул группу.", "command_groups_only": "Эту команду можно использовать только в группах.", - "// main.py": "Переводы для main.py", "userbot_started": "Userbot запущен!", "userbot_disconnected_cancelled_error": "Userbot отключен из-за исключения CancelledError.", "error_occurred": "Произошла ошибка: {error}", "abort_signal_received": "Получен сигнал прерывания. Закрытие Userbot…", - "// video_downloader.py": "Переводы для video_downloader.py", "video": "Видео: '{video_title}'", "video_downloaded_successfully": "Видео '{video_title}' успешно загружено! Отправка…", "error_downloading_video": "Ошибка при загрузке видео: {error}", - "// copy.py": "Переводы для copy.py", "copy_successfully": "Аккаунт успешно клонирован", - "// dellog.py": "Переводы для dellog.py", "dellog_successfully": "Файл журнала успешно удален.", "dellog_missing": "Файл журнала отсутствует.", - "// dm.py": "Переводы для dm.py", "provide_username_dm": "Пожалуйста, укажите имя пользователя и сообщение.", "user_not_found": "Не удалось найти пользователя. Пожалуйста, укажите действительное имя пользователя.", "message_sent": "Сообщение отправлено @{username}!", - "// info.py": "Переводы для info.py", "system_info_title": "ℹ️ Информация о системе:", "os": "💻 ОС", "kernel": "🔳 Ядро", @@ -48,15 +39,12 @@ "ping": "📶 Пинг", "userbot_commands_link": "🤖 [Команды Userbot](https://telegra.ph/Userbot-commands-09-11-46)", "userbot_created_by": "👤 Userbot создан Elxes ©️", - "// delall.py": "Переводы для delall.py", "floodwait_error": "Аккаунт в режиме floodwait. Ожидание {waitingtime} секунд…", - "// backup.py": "Переводы для backup.py", "backup_complete": "Резервное копирование информации завершено!", "backup_error": "Произошла ошибка во время резервного копирования: {error}", "no_backup_files": "Резервные файлы не найдены.", "restore_complete": "Восстановление завершено!", "restore_error": "Произошла ошибка при восстановлении: {error}", - "// weather.py": "Переводы для weather.py", "ask_city": "Пожалуйста, укажите название города.", "city_not_found": "Город не найден, проверьте название и попробуйте снова.", "weather_in": "Погода в", @@ -65,11 +53,9 @@ "wind_speed": "🌬️ Скорость ветра", "description": "🔍 Описание", "pressure": "🔵 Давление", - "// timer.py": "Переводы для timer.py", "timer_started": "⏳ Таймер запущен: {reason}\nОсталось: {countdown_time} секунд.", "timer_running": "⏳ Таймер запущен: {reason}\nОсталось: {time_display}", "timer_finished": "✅ Таймер завершён: {reason}!", - "// shorten.py": "Переводы для shorten.py", "url_shortened": "URL сокращен с помощью TinyURL: {shortened_url}", "error_shortening_url": "Произошла ошибка при сокращении URL.", "provide_url_to_shorten": "Пожалуйста, укажите URL для сокращения." diff --git a/translations/uk.json b/translations/uk.json index ea31bf9..1998fba 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -1,10 +1,8 @@ { "mention_or_reply_user": "Ви повинні відповісти на повідомлення користувача або згадати користувача, щоб скористатися цією командою.", - "// video_downloader.py": "Переклади для video_downloader.py", "user_added_whitelist": "Користувача {user_id} додано до білого списку.", "blocked_reported": "Вас заблоковано та повідомлено про спам.", "warning_message": "Попередження {current_warning}/{warning_count}: Ви не можете зв’язатися з цим користувачем. Припиніть надсилати повідомлення, інакше вас заблокують.", - "// whitelist.py": "Переклади для whitelist.py", "user_whitelisted": "Користувач {user_id} уже в білому списку.", "dellog_successfully": "Файл журналу успішно видалено.", "copy_successfully": "Обліковий запис успішно клоновано", @@ -18,16 +16,12 @@ "error_downloading_video": "Помилка завантаження відео: {error}", "user_not_in_whitelist": "Користувача {user_id} немає в білому списку.", "user_removed_whitelist": "Користувача {user_id} видалено з білого списку.", - "// infouser.py": "Переклади для infouser.py", "user_id": "ID: {user_id}", "user_username": "Ім'я користувача: @{username}", - "// leave.py": "Переклади для leave.py", - "// main.py": "Переклади для main.py", "userbot_started": "Юзербот запущено!", "userbot_disconnected_cancelled_error": "Userbot відключено через виняток CancelledError.", "abort_signal_received": "Отримано сигнал скасування. Закриття Userbot…", "video": "відео: '{video_title}'", - "// copy.py": "Переклади для copy.py", "dellog_missing": "Файл журналу відсутній.", "provide_username_dm": "Будь ласка, введіть ім'я користувача та повідомлення.", "message_sent": "Повідомлення надіслано @{username}!", @@ -51,25 +45,17 @@ "description": "🔍 опис", "pressure": "🔵 Тиск", "command_in_groups_only": "Ця команда працює лише в групах.", - "// dm.py": "Переклади для dm.py", "command_groups_only": "Цю команду можна використовувати лише в групах.", "cpu_usage": "⚡ Використання ЦП", - "// delall.py": "Переклади для delall.py", - "// weather.py": "Переклади для weather.py", "weather_in": "Погода в", - "// dellog.py": "Переклади для dellog.py", "system_info_title": "ℹ️ Інформація про систему:", "ram_total": "📉 загальна оперативна пам'ять", "user_not_found": "Не вдалося знайти користувача. Укажіть дійсне ім'я користувача.", - "// info.py": "Переклади для info.py", "ram_usage": "📈 використання оперативної пам'яті", "backup_error": "Під час резервного копіювання сталася помилка: {error}", - "// backup.py": "Переклади для backup.py", - "// timer.py": "Переклади для timer.py", "timer_started": "⏳ Таймер запущено: {reason}\nЗалишилось: {countdown_time} секунд.", "timer_running": "⏳ Таймер запущено: {reason}\nЗалишилось: {time_display}", "timer_finished": "✅ Таймер завершено: {reason}!", - "// shorten.py": "Переклади для shorten.py", "url_shortened": "URL скорочено за допомогою TinyURL: {shortened_url}", "error_shortening_url": "Під час скорочення URL сталася помилка.", "provide_url_to_shorten": "Будь ласка, надайте URL для скорочення." From 973b942a9d4320e8f63fcd56daef6308f8feb74b Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 15:40:04 +0100 Subject: [PATCH 07/15] Add translations for scheduling messages and invalid time format error --- commands/sched.py | 10 +++------- translations/de.json | 4 +++- translations/en.json | 4 +++- translations/es.json | 4 +++- translations/fr.json | 4 +++- translations/it.json | 4 +++- translations/pl.json | 4 +++- translations/ru.json | 4 +++- translations/uk.json | 4 +++- 9 files changed, 27 insertions(+), 15 deletions(-) diff --git a/commands/sched.py b/commands/sched.py index 91b7eca..d25d2d1 100644 --- a/commands/sched.py +++ b/commands/sched.py @@ -1,7 +1,7 @@ import re import time import asyncio - +from translations import translations scheduled_tasks = {} @@ -14,11 +14,9 @@ async def schedule_message(event): time_str = match.group(1) text = match.group(2) - time_value = int(time_str[:-1]) time_unit = time_str[-1] - if time_unit == 's': time_seconds = time_value elif time_unit == 'm': @@ -26,13 +24,11 @@ async def schedule_message(event): elif time_unit == 'h': time_seconds = time_value * 3600 else: - await event.respond("Invalid time format. Use Xs, Xm or Xh.") + await event.respond(translations["invalid_time_format"]) return - chat_id = event.chat_id - if chat_id not in scheduled_tasks: scheduled_tasks[chat_id] = [] @@ -44,4 +40,4 @@ async def send_scheduled_message(): task = asyncio.create_task(send_scheduled_message()) scheduled_tasks[chat_id].append(task) - await event.edit(f"I will post '{text}' every {time_str} in this chat. To cancel, use .cancsched") \ No newline at end of file + await event.edit(translations["schedule_message_success"].format(text=text, time_str=time_str)) \ No newline at end of file diff --git a/translations/de.json b/translations/de.json index 2642498..52ea10e 100644 --- a/translations/de.json +++ b/translations/de.json @@ -58,5 +58,7 @@ "timer_finished": "✅ Timer beendet: {reason}!", "url_shortened": "URL mit TinyURL verkürzt: {shortened_url}", "error_shortening_url": "Beim Verkürzen der URL ist ein Fehler aufgetreten.", - "provide_url_to_shorten": "Bitte geben Sie eine URL zum Verkürzen an." + "provide_url_to_shorten": "Bitte geben Sie eine URL zum Verkürzen an.", + "invalid_time_format": "Ungültiges Zeitformat. Verwenden Sie Xs, Xm oder Xh.", + "schedule_message_success": "Ich werde '{text}' alle {time_str} in diesem Chat posten. Um abzubrechen, verwenden Sie .cancsched" } diff --git a/translations/en.json b/translations/en.json index 0a24744..6b380b0 100644 --- a/translations/en.json +++ b/translations/en.json @@ -58,5 +58,7 @@ "timer_finished": "✅ Timer finished: {reason}!", "url_shortened": "URL shortened with TinyURL: {shortened_url}", "error_shortening_url": "An error occurred while shortening the URL.", - "provide_url_to_shorten": "Please provide a URL to shorten." + "provide_url_to_shorten": "Please provide a URL to shorten.", + "invalid_time_format": "Invalid time format. Use Xs, Xm or Xh.", + "schedule_message_success": "I will post '{text}' every {time_str} in this chat. To cancel, use .cancsched" } diff --git a/translations/es.json b/translations/es.json index eec9add..c9f1e1a 100644 --- a/translations/es.json +++ b/translations/es.json @@ -58,5 +58,7 @@ "timer_finished": "✅ Temporizador finalizado: {reason}!", "url_shortened": "URL acortada con TinyURL: {shortened_url}", "error_shortening_url": "Ocurrió un error al acortar la URL.", - "provide_url_to_shorten": "Por favor, proporciona una URL para acortar." + "provide_url_to_shorten": "Por favor, proporciona una URL para acortar.", + "invalid_time_format": "Formato de tiempo no válido. Usa Xs, Xm o Xh.", + "schedule_message_success": "Publicaré '{text}' cada {time_str} en este chat. Para cancelar, usa .cancsched" } diff --git a/translations/fr.json b/translations/fr.json index dc1a635..22a76dc 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -58,5 +58,7 @@ "timer_finished": "✅ Minuteur terminé : {reason}!", "url_shortened": "URL raccourcie avec TinyURL: {shortened_url}", "error_shortening_url": "Une erreur s'est produite lors du raccourcissement de l'URL.", - "provide_url_to_shorten": "Veuillez fournir une URL à raccourcir." + "provide_url_to_shorten": "Veuillez fournir une URL à raccourcir.", + "invalid_time_format": "Format de temps invalide. Utilisez Xs, Xm ou Xh.", + "schedule_message_success": "Je publierai '{text}' toutes les {time_str} dans ce chat. Pour annuler, utilisez .cancsched" } diff --git a/translations/it.json b/translations/it.json index 8329d62..4aec11a 100644 --- a/translations/it.json +++ b/translations/it.json @@ -58,5 +58,7 @@ "timer_finished": "✅ Timer terminato: {reason}!", "url_shortened": "URL accorciato con TinyURL: {shortened_url}", "error_shortening_url": "Si è verificato un errore durante l'accorciamento dell'URL.", - "provide_url_to_shorten": "Per favore, fornisci un URL da accorciare." + "provide_url_to_shorten": "Per favore, fornisci un URL da accorciare.", + "invalid_time_format": "Formato di tempo non valido. Usa Xs, Xm o Xh.", + "schedule_message_success": "Pubblicherò '{text}' ogni {time_str} in questa chat. Per annullare, usa .cancsched" } diff --git a/translations/pl.json b/translations/pl.json index 9d6635d..48750b4 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -58,5 +58,7 @@ "timer_finished": "✅ Timer zakończony: {reason}!", "url_shortened": "URL skrócony za pomocą TinyURL: {shortened_url}", "error_shortening_url": "Wystąpił błąd podczas skracania URL.", - "provide_url_to_shorten": "Proszę podać URL do skrócenia." + "provide_url_to_shorten": "Proszę podać URL do skrócenia.", + "invalid_time_format": "Nieprawidłowy format czasu. Użyj Xs, Xm lub Xh.", + "schedule_message_success": "Będę publikować '{text}' co {time_str} w tym czacie. Aby anulować, użyj .cancsched" } diff --git a/translations/ru.json b/translations/ru.json index c390633..8cf2246 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -58,5 +58,7 @@ "timer_finished": "✅ Таймер завершён: {reason}!", "url_shortened": "URL сокращен с помощью TinyURL: {shortened_url}", "error_shortening_url": "Произошла ошибка при сокращении URL.", - "provide_url_to_shorten": "Пожалуйста, укажите URL для сокращения." + "provide_url_to_shorten": "Пожалуйста, укажите URL для сокращения.", + "invalid_time_format": "Неправильный формат времени. Используйте Xs, Xm или Xh.", + "schedule_message_success": "Я буду публиковать '{text}' каждые {time_str} в этом чате. Чтобы отменить, используйте .cancsched" } diff --git a/translations/uk.json b/translations/uk.json index 1998fba..5279ad9 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -58,5 +58,7 @@ "timer_finished": "✅ Таймер завершено: {reason}!", "url_shortened": "URL скорочено за допомогою TinyURL: {shortened_url}", "error_shortening_url": "Під час скорочення URL сталася помилка.", - "provide_url_to_shorten": "Будь ласка, надайте URL для скорочення." + "provide_url_to_shorten": "Будь ласка, надайте URL для скорочення.", + "invalid_time_format": "Неправильний формат часу. Використовуйте Xs, Xm або Xh.", + "schedule_message_success": "Я буду публікувати '{text}' кожні {time_str} у цьому чаті. Щоб скасувати, використовуйте .cancsched" } From 1d6d5cbc96c61b3e6c15577c56444bc30cea3e42 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 15:50:50 +0100 Subject: [PATCH 08/15] Remove SECURITY.md file as it is no longer needed --- SECURITY.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 8b13789..0000000 --- a/SECURITY.md +++ /dev/null @@ -1 +0,0 @@ - From e9a6c2194792b23d893f6bb11a47ecd14849df31 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 15:50:59 +0100 Subject: [PATCH 09/15] updated README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c171bae..e0fec2c 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ We need your help to translate EXEUbot into different languages! If you are flue - [ ] Plugins repository (coming soon) - [ ] Ability to enable/disable a module from the config.ini file +- [ ] Ability to change commands prefix in config.ini file ## Contributing From 95b3567174d8f30daeda97e8b6d8a3c63a0b865d Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 15:55:26 +0100 Subject: [PATCH 10/15] Bump version to 1.50.1 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 78c3960..daf515c 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.50 \ No newline at end of file +1.50.1 \ No newline at end of file From 22041cd15bb8ebeae5d79ee97dc5fcc5a0522f66 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 16:40:59 +0100 Subject: [PATCH 11/15] Remove scheduling functionality from the bot --- commands/sched.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 commands/sched.py diff --git a/commands/sched.py b/commands/sched.py deleted file mode 100644 index d25d2d1..0000000 --- a/commands/sched.py +++ /dev/null @@ -1,43 +0,0 @@ -import re -import time -import asyncio -from translations import translations - -scheduled_tasks = {} - -async def schedule_message(event): - message = event.text - - match = re.search(r'\.sched\s+(\d+[s|m|h])\s+(.+)', message) - - if match: - time_str = match.group(1) - text = match.group(2) - - time_value = int(time_str[:-1]) - time_unit = time_str[-1] - - if time_unit == 's': - time_seconds = time_value - elif time_unit == 'm': - time_seconds = time_value * 60 - elif time_unit == 'h': - time_seconds = time_value * 3600 - else: - await event.respond(translations["invalid_time_format"]) - return - - chat_id = event.chat_id - - if chat_id not in scheduled_tasks: - scheduled_tasks[chat_id] = [] - - async def send_scheduled_message(): - while True: - await event.respond(text) - await asyncio.sleep(time_seconds) - - task = asyncio.create_task(send_scheduled_message()) - scheduled_tasks[chat_id].append(task) - - await event.edit(translations["schedule_message_success"].format(text=text, time_str=time_str)) \ No newline at end of file From 80888bca8726316cffe6e075d0085fd462ea4f51 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 16:41:04 +0100 Subject: [PATCH 12/15] Add translation support for timer command responses --- commands/timer.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/commands/timer.py b/commands/timer.py index f1e0e1e..09f9741 100644 --- a/commands/timer.py +++ b/commands/timer.py @@ -1,6 +1,8 @@ import re import asyncio +import json from telethon import events +from translations import translations def register(client): @client.on(events.NewMessage(pattern=r'^\.timer (\d+)([hms]) (.+)', outgoing=True)) @@ -9,7 +11,7 @@ async def timer_handler(event): # Parsing the command match = re.match(r'^\.timer (\d+)([hms]) (.+)', event.text) if not match: - await event.reply("Invalid command format. Use `.timer 2m reason`.") + await event.reply(translations["invalid_command_format"]) return time_value = int(match.group(1)) @@ -24,25 +26,24 @@ async def timer_handler(event): elif time_unit == 's': countdown_time = time_value else: - await event.reply("Invalid time unit. Use `h`, `m`, or `s`.") + await event.reply(translations["invalid_time_unit"]) return # Initial message - message = await event.reply(f"⏳ Timer started: {reason}\nRemaining: {countdown_time} seconds.") + message = await event.reply(translations["timer_started"].format(reason=reason, countdown_time=countdown_time)) # Countdown logic while countdown_time > 0: countdown_time -= 1 time_display = format_time(countdown_time) - await message.edit(f"⏳ Timer started: {reason}\nRemaining: {time_display}") + await message.edit(translations["timer_running"].format(reason=reason, time_display=time_display)) await asyncio.sleep(1) # Timer finished - await message.edit(f"✅ Timer finished: {reason}!") + await message.edit(translations["timer_finished"].format(reason=reason)) except Exception as e: - await event.reply(f"Error: {str(e)}") - + await event.reply(translations["error_occurred"].format(error=str(e))) def format_time(seconds): """Format seconds into a more readable hh:mm:ss format.""" hours, remainder = divmod(seconds, 3600) From 5b92d800e9383a6179dd2e1669ee11f0aff63dbe Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 16:48:34 +0100 Subject: [PATCH 13/15] Convert ping latency to integer for consistency in system info output --- commands/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/info.py b/commands/info.py index e3c7975..c7fc33c 100644 --- a/commands/info.py +++ b/commands/info.py @@ -18,7 +18,7 @@ async def system_info(event): st = speedtest.Speedtest(secure=True) server = st.get_best_server() - ping = server['latency'] + ping = int(server['latency']) system_info = platform.uname() python_version = platform.python_version() From 9e488055a337aaa6a3a0f9b62f6783bd7ffef164 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 16:49:15 +0100 Subject: [PATCH 14/15] Add sched.py to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 92d505b..0886e04 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ __pycache__/ config.ini cookies/cookies.txt +commands/sched.py From 5e9f6a83ebfe2097eae4094b73a70bbd797d1d36 Mon Sep 17 00:00:00 2001 From: Elxes04 Date: Thu, 16 Jan 2025 16:58:41 +0100 Subject: [PATCH 15/15] Update userbot commands link in translations for consistency --- translations/de.json | 2 +- translations/en.json | 2 +- translations/es.json | 2 +- translations/fr.json | 2 +- translations/it.json | 2 +- translations/pl.json | 2 +- translations/ru.json | 2 +- translations/uk.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/translations/de.json b/translations/de.json index 52ea10e..699f504 100644 --- a/translations/de.json +++ b/translations/de.json @@ -37,7 +37,7 @@ "ram_usage": "📈 RAM-Auslastung", "ram_total": "📉 Gesamter RAM", "ping": "📶 Ping", - "userbot_commands_link": "🤖 [Userbot-Befehle](https://telegra.ph/Userbot-commands-09-11-46)", + "userbot_commands_link": "🤖 [Userbot-Befehle](https://github.com/EXE-Official/EXEUbot/wiki/Commands)", "userbot_created_by": "👤 Userbot erstellt von Elxes ©️", "floodwait_error": "Das Konto ist im Floodwait. Warte {waitingtime} Sekunden…", "backup_complete": "Informationssicherung abgeschlossen!", diff --git a/translations/en.json b/translations/en.json index 6b380b0..a924b5c 100644 --- a/translations/en.json +++ b/translations/en.json @@ -37,7 +37,7 @@ "ram_usage": "📈 RAM usage", "ram_total": "📉 RAM total", "ping": "📶 Ping", - "userbot_commands_link": "🤖 [Userbot Commands](https://telegra.ph/Userbot-commands-09-11-46)", + "userbot_commands_link": "🤖 [Userbot Commands](https://github.com/EXE-Official/EXEUbot/wiki/Commands)", "userbot_created_by": "👤 Userbot created by Elxes ©️", "floodwait_error": "Account is in floodwait. Waiting for {waitingtime} seconds…", "backup_complete": "Information backup complete!", diff --git a/translations/es.json b/translations/es.json index c9f1e1a..ff8ac44 100644 --- a/translations/es.json +++ b/translations/es.json @@ -37,7 +37,7 @@ "ram_usage": "📈 Uso de RAM", "ram_total": "📉 RAM total", "ping": "📶 Ping", - "userbot_commands_link": "🤖 [Comandos de Userbot](https://telegra.ph/Userbot-commands-09-11-46)", + "userbot_commands_link": "🤖 [Comandos de Userbot](https://github.com/EXE-Official/EXEUbot/wiki/Commands)", "userbot_created_by": "👤 Userbot creado por Elxes ©️", "floodwait_error": "La cuenta está en floodwait. Esperando {waitingtime} segundos…", "backup_complete": "¡Copia de seguridad de la información completada!", diff --git a/translations/fr.json b/translations/fr.json index 22a76dc..2c043f8 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -37,7 +37,7 @@ "ram_usage": "📈 Utilisation RAM", "ram_total": "📉 RAM totale", "ping": "📶 Ping", - "userbot_commands_link": "🤖 [Commandes Userbot](https://telegra.ph/Userbot-commands-09-11-46)", + "userbot_commands_link": "🤖 [Commandes Userbot](https://github.com/EXE-Official/EXEUbot/wiki/Commands)", "userbot_created_by": "👤 Userbot créé par Elxes ©️", "floodwait_error": "Le compte est en attente de floodwait. Attente de {waitingtime} secondes…", "backup_complete": "Sauvegarde des informations terminée!", diff --git a/translations/it.json b/translations/it.json index 4aec11a..e4142b5 100644 --- a/translations/it.json +++ b/translations/it.json @@ -37,7 +37,7 @@ "ram_usage": "📈 Utilizzo RAM", "ram_total": "📉 RAM totale", "ping": "📶 Ping", - "userbot_commands_link": "🤖 [Comandi Userbot](https://telegra.ph/Userbot-commands-09-11-46)", + "userbot_commands_link": "🤖 [Comandi Userbot](https://github.com/EXE-Official/EXEUbot/wiki/Commands)", "userbot_created_by": "👤 Userbot creato da Elxes ©️", "floodwait_error": "L'account è in floodwait. Attendere {waitingtime} secondi…", "backup_complete": "Backup delle informazioni completato!", diff --git a/translations/pl.json b/translations/pl.json index 48750b4..fe2396c 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -37,7 +37,7 @@ "ram_usage": "📈 Użycie RAM", "ram_total": "📉 Całkowita pamięć RAM", "ping": "📶 Ping", - "userbot_commands_link": "🤖 [Komendy Userbot](https://telegra.ph/Userbot-commands-09-11-46)", + "userbot_commands_link": "🤖 [Komendy Userbot](https://github.com/EXE-Official/EXEUbot/wiki/Commands)", "userbot_created_by": "👤 Userbot stworzony przez Elxes ©️", "floodwait_error": "Konto jest w trybie floodwait. Czekaj {waitingtime} sekund…", "backup_complete": "Kopia zapasowa informacji zakończona!", diff --git a/translations/ru.json b/translations/ru.json index 8cf2246..07cb9c1 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -37,7 +37,7 @@ "ram_usage": "📈 Использование ОЗУ", "ram_total": "📉 Всего ОЗУ", "ping": "📶 Пинг", - "userbot_commands_link": "🤖 [Команды Userbot](https://telegra.ph/Userbot-commands-09-11-46)", + "userbot_commands_link": "🤖 [Команды Userbot](https://github.com/EXE-Official/EXEUbot/wiki/Commands)", "userbot_created_by": "👤 Userbot создан Elxes ©️", "floodwait_error": "Аккаунт в режиме floodwait. Ожидание {waitingtime} секунд…", "backup_complete": "Резервное копирование информации завершено!", diff --git a/translations/uk.json b/translations/uk.json index 5279ad9..c81c346 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -31,7 +31,7 @@ "telethon_version": "🤖 Телемарафонна версія", "userbot_version": "⚙️ Версія Userbot: ", "ping": "📶 Пінг", - "userbot_commands_link": "🤖 [Команди Userbot](https://telegra.ph/Userbot-commands-09-11-46)", + "userbot_commands_link": "🤖 [Команди Userbot](https://github.com/EXE-Official/EXEUbot/wiki/Commands)", "userbot_created_by": "👤 Користувач-бот, створений Elxes ©️", "floodwait_error": "Обліковий запис знаходиться в стані очікування. Очікування {waitingtime} секунд…", "backup_complete": "Резервне копіювання інформації завершено!",