Little test

This commit is contained in:
Stefano Assenzo 2023-01-24 15:10:19 +00:00
parent 56b021398d
commit 88a5bcdb33
1 changed files with 2 additions and 4 deletions

View File

@ -11,9 +11,7 @@ load_dotenv() # Load .env file
DISCORD_TOKEN = os.getenv('DISCORD_TOKEN') # Discord token DISCORD_TOKEN = os.getenv('DISCORD_TOKEN') # Discord token
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:" + \ mongo_url = "mongodb+srv://elci:" + urllib.parse.quote_plus(PASSWORD_MONGODB) + URL_MONGODB # URL for MongoDB (with password)
urllib.parse.quote_plus(PASSWORD_MONGODB) + \
URL_MONGODB # URL for MongoDB (with password)
client = pymongo.MongoClient(mongo_url) # Connect to MongoDB client = pymongo.MongoClient(mongo_url) # Connect to MongoDB
database = client["website-class"] # Database name database = client["website-class"] # Database name
# Collection school time table current # Collection school time table current
@ -36,7 +34,7 @@ async def orario(ctx):
# Send a message on channel #general with the subject found and the index of the subject # Send a message on channel #general with the subject found and the index of the subject
channel = bot.get_channel(1063753802638954519).send("bot is online") channel = bot.get_channel(1063753802638954519).send("bot is online")
await ctx.send(f"Subject found: {subject['Subject']} at index: {i}") await ctx.send(f"Subject found: {subject['Subject']} at index: {i}")
print(f"Subject: {subject['Subject'], Teacher: {subject['Teacher'], Room: {subject['Room']")
@bot.command() @bot.command()
async def testpy(ctx): async def testpy(ctx):