diff --git a/index.py b/index.py
index 2067292..18bb4c3 100644
--- a/index.py
+++ b/index.py
@@ -4,7 +4,6 @@ import pyfiglet
import socket
import threading
import datetime
-import subprocess
import telebot
import time
import ast
@@ -15,6 +14,9 @@ import python_weather
import asyncio
import requests
import json
+import goslate
+import urllib.request
+import urllib.parse
from yt_dlp import YoutubeDL
from platform import system
from tqdm.auto import tqdm
@@ -35,9 +37,11 @@ print("Il bot si è avviato con successo!")
#Command /start
@bot.message_handler(commands=['start'])
def send_welcome(message):
+ chat = message.chat.id
print("Triggered command START.")
- #bot.send_photo(message.chat.id, photo='https://i.imgur.com/XqQZQ.jpg')
- bot.reply_to(message, "😊 Benvenuto su **RetniNet**" "\n \nRetniNet è un bot privato per automatizzare e semplificare cose che facciamo quotidianamente. \n \n Creato & sviluppato da @Stef58_Official")
+ bot.send_photo(message.chat.id, photo='https://i.imgur.com/6YPJBze.png')
+ messageText = "✋ Benvenuto su RetniNet!\n\nRetniNet è un bot privato per automatizzare e semplificare cose che facciamo quotidianamente. \n\n👨💻 Creato & sviluppato da @Stef58_Official"
+ bot.send_message(chat,messageText, parse_mode="HTML")
#Command /music
@bot.message_handler(commands=['music'])
@@ -53,9 +57,9 @@ def select_music(pm):
}
sent_msg = bot.send_message(pm.chat.id, "Inserisci il link della canzone:")
bot.register_next_step_handler(sent_msg, music_step)
- bot.send_message(pm.chat.id, "🎶 Stiamo scaricando la canzone attenda...")
+
-def music_step(message):
+def music_step(pm):
ytdl_opts = {
'format': 'bestaudio/best',
'outtmpl': 'song.%(ext)s',
@@ -65,15 +69,18 @@ def music_step(message):
'preferredquality': '192',
}],
}
- url = message.text
+ url = pm.text
video = url
+ send_message = "🎶 Stiamo scaricando la canzone attenda..."
+ bot.send_message(pm.chat.id, send_message)
with YoutubeDL(ytdl_opts) as ydl:
info = ydl.extract_info(url, download=False)
name = info.get('title')
id = info.get('id')
ydl.download([id])
- bot.send_message(message.chat.id, "🎶" + name + " è stata scaricata con successo!")
- send_music(message)
+ send_message = "🎶 La canzone " + name + " è stata scaricata con successo!"
+ bot.send_message(pm.chat.id, send_message, parse_mode="HTML")
+ send_music(pm)
def send_music(message):
bot.send_audio(message.chat.id, audio=open('song.mp3', 'rb'))
@@ -83,7 +90,7 @@ def send_music(message):
@bot.message_handler(commands=['meteo'])
def meteo(pm):
print("Triggered command METEO.")
- sent_msg = bot.send_message(pm.chat.id, "Inserisci la città:")
+ sent_msg = bot.send_message(pm.chat.id, "🏙️ Inserisci la città:")
bot.register_next_step_handler(sent_msg, meteo_step)
def meteo_step(message):
@@ -91,9 +98,10 @@ def meteo_step(message):
response = requests.get("https://api.openweathermap.org/data/2.5/weather?q="+city+",it&APPID=dd9c01763daea0b5539db05fbfbe4cb6").json()
weather = response['weather'][0]['main']
temp = response['main']['temp']
+ weather_translate = goslate.Goslate(service_urls=['https://translate.google.it']).translate(weather, 'it')
temp = temp - 273.15
bot.send_message(message.chat.id, "🌡️ La temperatura in " + city + " è di " + str(temp) + "°C")
- bot.send_message(message.chat.id, "🌧️ La condizione è " + weather)
+ bot.send_message(message.chat.id, "🌧️ La condizione è " + weather_translate)
#Command /stats
@bot.message_handler(commands=['stats'])
@@ -107,7 +115,7 @@ def uptime(message):
msg = '''
CPU & RAM Info
-Utilizzo CPU = {} %
+🟩 Utilizzo CPU = {} %
RAM
Totale = {} MB
Usato = {} MB
@@ -115,4 +123,24 @@ Libero = {} MB
In uso = {} %\n'''.format(cpuUsage,ramTotal,ramUsage,ramFree,ramUsagePercent)
bot.send_message(message.chat.id,msg)
+#Command /pastebin
+@bot.message_handler(commands=['pastebin'])
+def pastebin(message):
+ print("Triggered command PASTEBIN.")
+ sent_msg = bot.send_message(message.chat.id, "📋 Inserisci il testo:")
+ bot.register_next_step_handler(sent_msg, pastebin_step)
+
+def pastebin_step(message):
+ chat = message.chat.id
+ text = message.text
+ site = 'https://pastebin.com/api/api_post.php'
+ dev_key = 'V701_05L-yFOUH_0J24VFiJQQ1WwHrbO'
+ code = text
+ our_data = urllib.parse.urlencode({"api_dev_key": dev_key, "api_option": "paste", "api_paste_code": code})
+ our_data = our_data.encode()
+ resp = urllib.request.urlopen(site, our_data)
+ resp = resp.read()
+ send_msg = "📋 Il tuo codice è stato inviato con successo!\n\nLink: " + str(resp)
+ bot.send_message(chat,send_msg, parse_mode="HTML")
+
bot.polling()
\ No newline at end of file
diff --git a/procfile b/procfile
deleted file mode 100644
index 8c65343..0000000
--- a/procfile
+++ /dev/null
@@ -1 +0,0 @@
-worker: python index.py
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
index 5d0478d..4598d87 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,9 +1,12 @@
# Automatically generated by https://github.com/damnever/pigar.
-# D:\Progetti Github\RetniNet\index.py: 26
+# D:\Progetti Github\RetniNet\index.py: 27
bs4 == 0.0.1
-# D:\Progetti Github\RetniNet\index.py: 23
+# D:\Progetti Github\RetniNet\index.py: 18
+goslate == 1.5.4
+
+# D:\Progetti Github\RetniNet\index.py: 24
jmespath == 1.0.0
# D:\Progetti Github\RetniNet\index.py: 1
@@ -18,17 +21,17 @@ python_ffmpeg == 1.0.14
# D:\Progetti Github\RetniNet\index.py: 14
python_weather == 0.3.7
-# D:\Progetti Github\RetniNet\index.py: 25
+# D:\Progetti Github\RetniNet\index.py: 26
pytube == 12.1.0
# D:\Progetti Github\RetniNet\index.py: 13,16
-requests == 2.25.1
+requests == 2.28.0
-# D:\Progetti Github\RetniNet\index.py: 24
+# D:\Progetti Github\RetniNet\index.py: 25
telebot == 0.0.4
-# D:\Progetti Github\RetniNet\index.py: 20
+# D:\Progetti Github\RetniNet\index.py: 21
tqdm == 4.64.0
-# D:\Progetti Github\RetniNet\index.py: 18
+# D:\Progetti Github\RetniNet\index.py: 19
yt_dlp == 2022.5.18
diff --git a/test.py b/test.py
deleted file mode 100644
index 168d41d..0000000
--- a/test.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import EpicGamesStoreAPI as api
-
-api = EpicGamesStoreAPI()
-namespace, slug = list(api.get_product_mapping().items())[0]
-first_product = api.get_product(slug)
-offers = []
-for page in first_product['pages']:
- if page.get('offer') is not None:
- offers.append(OfferData(page['namespace'], page['offer']['id']))
-offers_data = api.get_offers_data(*offers)
-for offer_data in offers_data:
- data = offer_data['data']['Catalog']['catalogOffer']
- developer_name = ''
- for custom_attribute in data['customAttributes']:
- if custom_attribute['key'] == 'developerName':
- developer_name = custom_attribute['value']
- print('Offer ID:', data['id'], '\nDeveloper Name:', developer_name)
\ No newline at end of file