Create .env for token and password

This commit is contained in:
stef-devs 2022-06-18 11:58:15 +02:00
parent 5be64b4488
commit 6006f4cf75
4 changed files with 24 additions and 16 deletions

4
.gitignore vendored
View File

@ -1 +1,3 @@
ffmpeg.exe
ffmpeg.exe
.env
test.py

View File

@ -17,6 +17,7 @@ import json
import goslate
import urllib.request
import urllib.parse
from dotenv import load_dotenv
from yt_dlp import YoutubeDL
from platform import system
from tqdm.auto import tqdm
@ -28,7 +29,8 @@ from pytube import YouTube
from bs4 import BeautifulSoup
from gc import callbacks
API_TOKEN = '5407819601:AAEfiaw8ZNlyBHftLsJR5VAcMyv257tWHMY'
load_dotenv()
API_TOKEN = os.getenv('BOT_TOKEN')
bot = telebot.TeleBot(API_TOKEN)
print("Il bot si è avviato con successo!")
@ -95,13 +97,14 @@ def meteo(pm):
def meteo_step(message):
city = message.text
response = requests.get("https://api.openweathermap.org/data/2.5/weather?q="+city+",it&APPID=dd9c01763daea0b5539db05fbfbe4cb6").json()
token_weather = os.environ.get('WEATHER_TOKEN')
response = requests.get("https://api.openweathermap.org/data/2.5/weather?q="+city+",it&APPID="+token_weather).json()
print(response)
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_translate)
bot.send_message(message.chat.id, "🌧️ La condizione è " + weather)
#Command /stats
@bot.message_handler(commands=['stats'])
@ -134,7 +137,7 @@ 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'
dev_key = os.environ.get('PASTEBIN_TOKEN')
code = text
our_data = urllib.parse.urlencode({"api_dev_key": dev_key, "api_option": "paste", "api_paste_code": code})
our_data = our_data.encode()

0
nuvola.py Normal file
View File

View File

@ -1,12 +1,12 @@
# Automatically generated by https://github.com/damnever/pigar.
# D:\Progetti Github\RetniNet\index.py: 27
# D:\Progetti Github\RetniNet\index.py: 29
bs4 == 0.0.1
# D:\Progetti Github\RetniNet\index.py: 18
# D:\Progetti Github\RetniNet\index.py: 17
goslate == 1.5.4
# D:\Progetti Github\RetniNet\index.py: 24
# D:\Progetti Github\RetniNet\index.py: 26
jmespath == 1.0.0
# D:\Progetti Github\RetniNet\index.py: 1
@ -15,23 +15,26 @@ psutil == 5.9.1
# D:\Progetti Github\RetniNet\index.py: 3
pyfiglet == 0.8.post1
# D:\Progetti Github\RetniNet\index.py: 11
# D:\Progetti Github\RetniNet\index.py: 20
python_dotenv == 0.20.0
# D:\Progetti Github\RetniNet\index.py: 10
python_ffmpeg == 1.0.14
# D:\Progetti Github\RetniNet\index.py: 14
# D:\Progetti Github\RetniNet\index.py: 13
python_weather == 0.3.7
# D:\Progetti Github\RetniNet\index.py: 26
# D:\Progetti Github\RetniNet\index.py: 28
pytube == 12.1.0
# D:\Progetti Github\RetniNet\index.py: 13,16
# D:\Progetti Github\RetniNet\index.py: 12,15
requests == 2.28.0
# D:\Progetti Github\RetniNet\index.py: 25
# D:\Progetti Github\RetniNet\index.py: 27
telebot == 0.0.4
# D:\Progetti Github\RetniNet\index.py: 21
# D:\Progetti Github\RetniNet\index.py: 23
tqdm == 4.64.0
# D:\Progetti Github\RetniNet\index.py: 19
# D:\Progetti Github\RetniNet\index.py: 21
yt_dlp == 2022.5.18