Skip to content

on_member_join error when member id cannot be found in database

Ignoring exception in on_member_join
Traceback (most recent call last):
  File "/opt/discord/rsvp-bot-v3.1.0/lib/python3.9/site-packages/pymysql/connections.py", line 756, in _write_bytes
    self._sock.sendall(data)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/discord/rsvp-bot-v3.1.0/main2.py", line 351, in on_member_join
    dbcursor.execute(f"SELECT rsvped FROM tceu22_rsvp WHERE discord_id = {member.id}")
  File "/opt/discord/rsvp-bot-v3.1.0/lib/python3.9/site-packages/pymysql/cursors.py", line 148, in execute
    result = self._query(query)
  File "/opt/discord/rsvp-bot-v3.1.0/lib/python3.9/site-packages/pymysql/cursors.py", line 310, in _query
    conn.query(q)
  File "/opt/discord/rsvp-bot-v3.1.0/lib/python3.9/site-packages/pymysql/connections.py", line 547, in query
    self._execute_command(COMMAND.COM_QUERY, sql)
  File "/opt/discord/rsvp-bot-v3.1.0/lib/python3.9/site-packages/pymysql/connections.py", line 814, in _execute_command
    self._write_bytes(packet)
  File "/opt/discord/rsvp-bot-v3.1.0/lib/python3.9/site-packages/pymysql/connections.py", line 759, in _write_bytes
    raise err.OperationalError(
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/discord/rsvp-bot-v3.1.0/lib/python3.9/site-packages/discord/client.py", line 375, in _run_event
    await coro(*args, **kwargs)
  File "/opt/discord/rsvp-bot-v3.1.0/main2.py", line 359, in on_member_join
    await on_member_join(member)  # re-call to reprocess
  File "/opt/discord/rsvp-bot-v3.1.0/main2.py", line 352, in on_member_join
    rsvped = dbcursor.fetchone()[0]
TypeError: 'NoneType' object is not subscriptable