Update readme.md and little bug fix on index.py

This commit is contained in:
stef-devs 2022-06-21 19:16:38 +02:00
parent 94466c4fba
commit d788a08177
4 changed files with 55 additions and 15 deletions

2
.gitignore vendored
View File

@ -1,8 +1,8 @@
ffmpeg.exe
.env
test.py
.cache
music_cache
nuvola.py
debug.log
nuvola.txt
test.py

View File

@ -1,2 +1,47 @@
# RetniNet
<img src="/images/logo.png" alt="RetniNet Logo" align="right" height="256px">
<div align="center">
<h1>RetniNet</h1>
<h3>A Telegram bot written in Python, totaly free and open-source.</h3>
![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)
</div>
___
### 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 |

BIN
images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

View File

@ -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, "🚫 <b>Errore</b>\n\n<b>Il link</b> 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 <b>link</b> valido!")
bot.send_message(chat, pm.chat.id,"🚫 Devi inserire un <b>link</b> 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()