From 140c6a51c7ecac43dba87862838a9929526ac1f1 Mon Sep 17 00:00:00 2001 From: SimolZimol <70102430+SimolZimol@users.noreply.github.com> Date: Fri, 9 Jan 2026 21:49:39 +0100 Subject: [PATCH] modified: bot.py --- bot.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bot.py b/bot.py index 0c5ec03..e9636b4 100644 --- a/bot.py +++ b/bot.py @@ -41,6 +41,8 @@ def get_db_connection(): def init_db(): conn = get_db_connection() cursor = conn.cursor() + + # Create tables with utf8mb4 charset cursor.execute(''' CREATE TABLE IF NOT EXISTS tickets ( ticket_id VARCHAR(32) PRIMARY KEY, @@ -62,6 +64,16 @@ def init_db(): archive_channel_id BIGINT ) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ''') + + # Convert existing tables to utf8mb4 if needed + try: + cursor.execute('ALTER TABLE tickets CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci') + cursor.execute('ALTER TABLE server_settings CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci') + print("Database tables converted to utf8mb4") + except Exception as e: + # Tables might already be utf8mb4 or might not exist yet + print(f"Table conversion info: {e}") + conn.commit() cursor.close() conn.close()