Compare commits

...

3 Commits

Author SHA1 Message Date
Stefano Assenzo 177374a894
Ok 2023-01-28 17:42:28 +00:00
Stefano Assenzo 3f75138d16
Reorder libraries on app.py 2023-01-28 17:41:45 +00:00
Stefano Assenzo 23ac13f5d1
Now it's all about .env - I started making Whatsapp bot 2023-01-28 17:39:21 +00:00
4 changed files with 27 additions and 10 deletions

View File

@ -14,4 +14,12 @@ DOWNLOAD_FOLDER = ""
USERNAME_NUVOLA = "" USERNAME_NUVOLA = ""
PASSWORD_NUVOLA = "" PASSWORD_NUVOLA = ""
DISCORD_TOKEN = "" # Discord
DISCORD_TOKEN = ""
GENERAL_ID = ""
# Whatsapp
SID = ""
AUTHTOKEN = ""
PHONE_NUMBER_BOT = ""
PHONE_NUMBER_PERSONAL = ""

11
app.py
View File

@ -1,14 +1,9 @@
from flask import Flask, render_template, request, session, jsonify, redirect from urllib.request import Request, urlopen
from dotenv import load_dotenv from flask import Flask, render_template
import requests
import urllib.request, json
import pymongo
import logging import logging
import bcrypt import json
import sys import sys
import os import os
from urllib import request
from urllib.request import Request, urlopen
logging.basicConfig( logging.basicConfig(
level=logging.INFO, level=logging.INFO,

View File

@ -18,6 +18,7 @@ import time
load_dotenv() # Load .env file load_dotenv() # Load .env file
DISCORD_TOKEN = os.getenv('DISCORD_TOKEN') # Discord token DISCORD_TOKEN = os.getenv('DISCORD_TOKEN') # Discord token
GENERAL_ID = os.getenv('GENERAL_ID') # Channel ID
PASSWORD_MONGODB = os.getenv('PASSWORD_MONGODB') # Password for MongoDB PASSWORD_MONGODB = os.getenv('PASSWORD_MONGODB') # Password for MongoDB
URL_MONGODB = os.getenv('URL_MONGODB') # URL for MongoDB URL_MONGODB = os.getenv('URL_MONGODB') # URL for MongoDB
mongo_url = "mongodb+srv://elci:" + urllib.parse.quote_plus(PASSWORD_MONGODB) + URL_MONGODB # URL for MongoDB (with password) mongo_url = "mongodb+srv://elci:" + urllib.parse.quote_plus(PASSWORD_MONGODB) + URL_MONGODB # URL for MongoDB (with password)
@ -68,7 +69,7 @@ async def orario():
send_screenshot += 1 send_screenshot += 1
else: else:
pass pass
channel = bot.get_channel(1063753802638954519) channel = bot.get_channel(GENERAL_ID)
await channel.send(f"Day: {day}, Hour school: {i}, Subject found: {subject['Subject']} at index: {i}") await channel.send(f"Day: {day}, Hour school: {i}, Subject found: {subject['Subject']} at index: {i}")
send_screenshot = 0 send_screenshot = 0

View File

@ -0,0 +1,13 @@
from twilio.rest import Client
import os
SID = os.getenv('SID')
AUTH_TOKEN = os.getenv('AUTHTOKEN')
PHONE_NUMBER_BOT = os.getenv('PHONE_NUMBER_BOT')
PHONE_NUMBER_PERSONAL = os.getenv('PHONE_NUMBER_PERSONAL')
client = Client(SID, AUTH_TOKEN)
message = client.messages.create(to=PHONE_NUMBER_PERSONAL,
from_=PHONE_NUMBER_BOT,
body="Hello from Python!")