axololly / qoyyuum

0 stars 1 forks source link

messages table not found #4

Open Qoyyuum opened 7 months ago

Qoyyuum commented 7 months ago
timezonebot  | 2024-05-06 16:35:16 INFO     discord.client logging in using static token
timezonebot  | 2024-05-06 16:35:17 ERROR    discord.ext.tasks Unhandled exception in internal background task 'clear_db'.
timezonebot  | Traceback (most recent call last):
timezonebot  |   File "/usr/local/lib/python3.12/site-packages/discord/ext/tasks/__init__.py", line 239, in _loop
timezonebot  |     await self.coro(*args, **kwargs)
timezonebot  |   File "/app/timezones.py", line 224, in clear_db
timezonebot  |     await conn.execute("DELETE FROM messages")
timezonebot  |   File "/usr/local/lib/python3.12/site-packages/asqlite/__init__.py", line 138, in _runner
timezonebot  |     ret = await future
timezonebot  |           ^^^^^^^^^^^^
timezonebot  |   File "/usr/local/lib/python3.12/site-packages/asqlite/__init__.py", line 89, in _call_entry
timezonebot  |     result = entry.func(*entry.args, **entry.kwargs)
timezonebot  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
timezonebot  | sqlite3.OperationalError: no such table: messages
timezonebot  | 2024-05-06 16:35:18 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: 430c76910e4e9c5998967db7a8069ea7).

Can't delete from messages if the database doesn't exist.

Qoyyuum commented 7 months ago

@axololly

axololly commented 7 months ago

Probably just needs to be created. Run the "messages" table creation statement in the "Dependencies" section and you should be good to go.

Qoyyuum commented 7 months ago

I've edited the code so that it creates those tables on start up but now I'm hitting with various bugs like

timezonebot  | Traceback (most recent call last):
timezonebot  |   File "/usr/local/lib/python3.12/site-packages/discord/client.py", line 441, in _run_event
timezonebot  |     await coro(*args, **kwargs)
timezonebot  |   File "/app/timezones.py", line 153, in check_messages_per_minute
timezonebot  |     await conn.execute("""INSERT INTO messages (guild_id, channel_id) VALUES (?, ?)
timezonebot  |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
timezonebot  | TypeError: 'str' object is not callable

I fixed it with a comma on line 153 and then another bug

timezonebot  | Traceback (most recent call last):
timezonebot  |   File "/usr/local/lib/python3.12/site-packages/discord/client.py", line 441, in _run_event
timezonebot  |     await coro(*args, **kwargs)
timezonebot  |   File "/app/timezones.py", line 153, in check_messages_per_minute
timezonebot  |     await conn.execute("""INSERT INTO messages (guild_id, channel_id) VALUES (?, ?)
timezonebot  |   File "/usr/local/lib/python3.12/site-packages/asqlite/__init__.py", line 138, in _runner
timezonebot  |     ret = await future
timezonebot  |           ^^^^^^^^^^^^
timezonebot  |   File "/usr/local/lib/python3.12/site-packages/asqlite/__init__.py", line 89, in _call_entry
timezonebot  |     result = entry.func(*entry.args, **entry.kwargs)
timezonebot  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
timezonebot  | sqlite3.OperationalError: near "SET": syntax error

I propose switching this to Supabase. Thoughts @axololly ?