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