EAHonepot/check_config.py
snfsx 78bbcb7ebb Inital upload
inital upload
2024-11-19 19:25:45 +00:00

27 lines
746 B
Python

import sqlite3
def load_config():
conn = sqlite3.connect("config.db")
cursor = conn.cursor()
cursor.execute("SELECT tg_bot_token, chat_id, cb, ma, delay, port FROM config LIMIT 1")
config = cursor.fetchone()
conn.close()
if not config:
raise ValueError("No configuration")
return {
"tg_bot_token": config[0],
"chat_id": config[1],
"cb": config[2],
"ma": config[3],
"delay": config[4],
"port": config[5],
}
if __name__ == "__main__":
try:
config = load_config()
print("Configuration:")
for key, value in config.items():
print(f"{key}: {value}")
except ValueError as e:
print(e)