Legacy removals, code restructuring, add send_... functions and better help

This commit is contained in:
2024-08-10 01:36:54 +02:00
parent 183b8c60cd
commit 6ebc68127e
32 changed files with 512 additions and 351 deletions

View File

@ -1,12 +1,12 @@
# ================================== #
# WinDog multi-purpose chatbot #
# Licensed under AGPLv3 by OctoSpacc #
# ================================== #
# ==================================== #
# WinDog multi-purpose chatbot #
# Licensed under AGPLv3 by OctoSpacc #
# ==================================== #
from peewee import *
from LibWinDog.Types import *
Db = SqliteDatabase("Database.sqlite")
Db = SqliteDatabase("./Data/Database.sqlite")
class BaseModel(Model):
class Meta:
@ -28,3 +28,10 @@ class Room(Entity):
Db.create_tables([EntitySettings, User, Room], safe=True)
class UserSettingsData():
def __new__(cls, user_id:str) -> SafeNamespace|None:
try:
return SafeNamespace(**EntitySettings.select().join(User).where(User.id == user_id).dicts().get())
except EntitySettings.DoesNotExist:
return None