Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Server: guild_id to guild #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions System/levelsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ async def on_guild_join(self, guild):
# get database type from config file
db_type = config["Database_Type"]
if db_type.lower() == "mongodb":
levelling.insert_one({"guild_id": guild.id, "main_channel": None, "admin_role": None, "roles": [],
levelling.insert_one({"guild": guild.id, "main_channel": None, "admin_role": None, "roles": [],
"role_levels": [], 'talkchannels': []})
for member in guild.members:
# check if member is a bot
Expand All @@ -105,7 +105,7 @@ async def on_guild_join(self, guild):
elif db_type.lower() == "local":
db = sqlite3.connect("KumosLab/Database/Local/serverbase.sqlite")
cursor = db.cursor()
sql = "INSERT INTO levelling (guild_id, admin_role, main_channel, talkchannels) VALUES (?, ?, ?, ?)"
sql = "INSERT INTO levelling (guild, admin_role, main_channel, talkchannels) VALUES (?, ?, ?, ?)"
val = (guild.id, None, None, None)
cursor.execute(sql, val)
db.commit()
Expand All @@ -130,13 +130,13 @@ async def on_guild_remove(self, guild):
# get database type from config file
db_type = config["Database_Type"]
if db_type.lower() == "mongodb":
levelling.delete_one({"guild_id": guild.id})
levelling.delete_one({"guild": guild.id})
for member in guild.members:
levelling.delete_one({"guild_id": guild.id, "user_id": member.id})
elif db_type.lower() == "local":
db = sqlite3.connect("KumosLab/Database/Local/serverbase.sqlite")
cursor = db.cursor()
sql = "DELETE FROM levelling WHERE guild_id = ?"
sql = "DELETE FROM levelling WHERE guild = ?"
val = (guild.id,)
cursor.execute(sql, val)
db.commit()
Expand Down