diff --git a/.gitignore b/.gitignore index 1557c8a..4625173 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ ffmpeg.exe .env -test.py .cache music_cache nuvola.py debug.log -nuvola.txt \ No newline at end of file +nuvola.txt +test.py \ No newline at end of file diff --git a/README.md b/README.md index 4674079..09845b0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,47 @@ # RetniNet - +RetniNet Logo +
+

RetniNet

+

A Telegram bot written in Python, totaly free and open-source.

+ +![Repository Size](https://img.shields.io/github/repo-size/assenzostefano/retninet) +![Issues](https://img.shields.io/github/issues/assenzostefano/retninet) +![Pull Requests](https://img.shields.io/github/issues-pr/assenzostefano/retninet) +
+ +___ +### Online on: +- [Telegram Bot](https://t.me/Retninet_bot) + +___ +### Installation and launching: +- Install **[Python](https://python.org)** on your machine. **Version 3.10 or higher is required!** +- Clone the repository on your machine. +- Open your console in the cloned repository. +- To complete the installation, write the following command in the console: +```console +pip install -r requirements.txt +``` +- After installation, you will need to **[configure the bot](#bot-config)**. +- To start the bot, write the following command in the console: +```console +python index.py +``` + +___ +### Bot config: + +**DISCLAIMER: We won't help you rebranding the bot for any other server. If you really want to do that, then you need to figure it out yourself.** + +- Create a bot on the **[BotFather](https://t.me/BotFather)**. +- Go to the **Bot** tab, create a bot and copy its token. +- Create a file named **.env** or rename the **.env.example** file to **.env**. +- Open the **.env** file using any text editor. +- This file contains general bot settings in this format: + +| Field name | Example value | Description | +|:-----------------------:|:------------------------------------------:|:------------------------------------------------------------------------------:| +| botToken | "-" | The token you copied from the BotFather, used to login the bot. | +| pastebinToken | "-" | Paste the Pastebin Token on the .env.example | +| weatherToken | "-" | Paste the Weather Token on the .env.example | +| deeplToken | "924159913024958505" | Paste the Deepl Token on the .env.example | diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..ca44653 Binary files /dev/null and b/images/logo.png differ diff --git a/index.py b/index.py index 3d6c772..4ad7681 100644 --- a/index.py +++ b/index.py @@ -112,6 +112,7 @@ def music_step(pm): bot.send_audio(pm.chat.id, audio=open("music_cache/" + name + '.mp3', 'rb')) os.remove("music_cache/" + name + '.mp3') logging.info("\"" + name + "\" è stato scaricato ed eliminato con successo!") + elif pm.text.startswith('https://youtube.com/') or pm.text.startswith('youtube.com/'): bot.send_message( pm.chat.id, "🚫 Errore\n\nIl link inserito non è valido!") @@ -135,8 +136,7 @@ def music_step(pm): else: chat = pm.chat.id - bot.send_message(chat, pm.chat.id, - "🚫 Devi inserire un link valido!") + bot.send_message(chat, pm.chat.id,"🚫 Devi inserire un link valido!") #Command /meteo @@ -240,8 +240,7 @@ def epicgames_step(message): current_games_description, target_lang='IT') result_description = description_translate.text send_img = bot.send_photo(message.chat.id, image_currentgames) - sent_msg = bot.send_message( - message.chat.id, "🎮 Il gioco gratis di oggi è " + current_games + "\n\n" + result_description) + sent_msg = bot.send_message(message.chat.id, "🎮 Il gioco gratis di oggi è " + current_games + "\n\n" + result_description) else: logging.info("Triggered command EPICGAMES FUTURO.") # URL API @@ -255,12 +254,10 @@ def epicgames_step(message): future_games_description1 = response['nextGames'][0]['description'] # Token for translate translator = deepl.Translator(os.getenv('DEEPL_TOKEN')) - description_translate1 = translator.translate_text( - future_games_description1, target_lang='IT') + description_translate1 = translator.translate_text(future_games_description1, target_lang='IT') result_description1 = description_translate1.text send_img = bot.send_photo(message.chat.id, image_futuregames1) - sent_msg = bot.send_message( - message.chat.id, "🎮 Il gioco futuro è " + future_games1 + "\n\n" + result_description1) + sent_msg = bot.send_message(message.chat.id, "🎮 Il gioco futuro è " + future_games1 + "\n\n" + result_description1) # Title of future games future_games2 = response['nextGames'][1]['title'] # Image future games @@ -268,12 +265,10 @@ def epicgames_step(message): # Description future games future_games_description2 = response['nextGames'][1]['description'] # Traslate description future games - description_translate2 = translator.translate_text( - future_games_description2, target_lang='IT') + description_translate2 = translator.translate_text(future_games_description2, target_lang='IT') result_description2 = description_translate2.text send_img = bot.send_photo(message.chat.id, image_futuregames2) - sent_msg = bot.send_message( - message.chat.id, "🎮 Il gioco futuro è " + future_games2 + "\n\n" + result_description2) + sent_msg = bot.send_message(message.chat.id, "🎮 Il gioco futuro è " + future_games2 + "\n\n" + result_description2) bot.polling()