|
|
|
@ -113,14 +113,14 @@ async def on_member_join(member):
|
|
|
|
|
# Make sure the guild is Enso
|
|
|
|
|
if guild.id != enso_guild_ID:
|
|
|
|
|
return
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# Set up connection to database
|
|
|
|
|
with db.connection() as conn:
|
|
|
|
|
name = f"{member.name}#{member.discriminator}"
|
|
|
|
|
# Define the Insert Into Statement inserting into the database
|
|
|
|
|
insert_query = """INSERT INTO members (discordID, discordUser) VALUES (?, ?)"""
|
|
|
|
|
vals = member.id, name
|
|
|
|
|
insert_query = """INSERT INTO members (discordUser, discordID) VALUES (?, ?)"""
|
|
|
|
|
vals = name, member.id
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
|
|
# Execute the SQL Query
|
|
|
|
@ -168,13 +168,15 @@ async def on_member_remove(member):
|
|
|
|
|
# Get the guild
|
|
|
|
|
guild = member.guild
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# Make sure the guild is Enso
|
|
|
|
|
if guild.id != enso_guild_ID:
|
|
|
|
|
return
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# With the database connection
|
|
|
|
|
with db.connection() as conn:
|
|
|
|
|
# Define the Insert Into Statement inserting into the database
|
|
|
|
|
|
|
|
|
|
# Delete the record of the member as they leave the server
|
|
|
|
|
insert_query = """DELETE FROM members WHERE discordID = (?)"""
|
|
|
|
|
val = member.id,
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
@ -250,16 +252,4 @@ def write_to_dm_file(time, author, content):
|
|
|
|
|
msg_time = time.strftime('%Y-%m-%dT%H:%M:%S')
|
|
|
|
|
msg_author = message.author
|
|
|
|
|
msg_content = message.content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|