Bug fixes and small structural changes #7
@ -7,53 +7,11 @@ from pyrogram.errors import bad_request_400
|
|||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
from classes.errors.geo import PlaceNotFoundError
|
from classes.errors.geo import PlaceNotFoundError
|
||||||
from classes.errors.holo_user import UserInvalidError, UserNotFoundError, LabelTooLongError, LabelSettingError
|
from classes.errors.holo_user import UserInvalidError, UserNotFoundError, LabelTooLongError, LabelSettingError
|
||||||
|
from classes.templates import DefaultApplicationTemp, DefaultSponsorshipTemp
|
||||||
from modules.database import col_tmp, col_users, col_applications, col_sponsorships, col_messages, col_spoilers
|
from modules.database import col_tmp, col_users, col_applications, col_sponsorships, col_messages, col_spoilers
|
||||||
from modules.logging import logWrite
|
from modules.logging import logWrite
|
||||||
from modules.utils import configGet, find_location, locale, should_quote
|
from modules.utils import configGet, find_location, locale, should_quote
|
||||||
|
|
||||||
class DefaultApplicationTemp(dict):
|
|
||||||
def __init__(self, user: int, reapply: bool = False):
|
|
||||||
super().__init__({})
|
|
||||||
self.dict = {
|
|
||||||
"user": user,
|
|
||||||
"type": "application",
|
|
||||||
"complete": False,
|
|
||||||
"sent": False,
|
|
||||||
"state": "fill",
|
|
||||||
"reapply": reapply,
|
|
||||||
"stage": 1,
|
|
||||||
"application": {
|
|
||||||
"1": None,
|
|
||||||
"2": None,
|
|
||||||
"3": None,
|
|
||||||
"4": None,
|
|
||||||
"5": None,
|
|
||||||
"6": None,
|
|
||||||
"7": None,
|
|
||||||
"8": None,
|
|
||||||
"9": None,
|
|
||||||
"10": None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class DefaultSponsorshipTemp(dict):
|
|
||||||
def __init__(self, user: int):
|
|
||||||
super().__init__({})
|
|
||||||
self.dict = {
|
|
||||||
"user": user,
|
|
||||||
"type": "sponsorship",
|
|
||||||
"complete": False,
|
|
||||||
"sent": False,
|
|
||||||
"state": "fill",
|
|
||||||
"stage": 1,
|
|
||||||
"sponsorship": {
|
|
||||||
"streamer": None,
|
|
||||||
"expires": datetime.fromtimestamp(0),
|
|
||||||
"proof": None,
|
|
||||||
"label": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class HoloUser():
|
class HoloUser():
|
||||||
"""This object represents a user of HoloChecker bot.
|
"""This object represents a user of HoloChecker bot.
|
||||||
It is primarily used to interact with a database in a more python-friendly way,
|
It is primarily used to interact with a database in a more python-friendly way,
|
||||||
|
46
classes/templates.py
Normal file
46
classes/templates.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
"""Templates for temporary application/sponsorship records"""
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
class DefaultApplicationTemp(dict):
|
||||||
|
def __init__(self, user: int, reapply: bool = False):
|
||||||
|
super().__init__({})
|
||||||
|
self.dict = {
|
||||||
|
"user": user,
|
||||||
|
"type": "application",
|
||||||
|
"complete": False,
|
||||||
|
"sent": False,
|
||||||
|
"state": "fill",
|
||||||
|
"reapply": reapply,
|
||||||
|
"stage": 1,
|
||||||
|
"application": {
|
||||||
|
"1": None,
|
||||||
|
"2": None,
|
||||||
|
"3": None,
|
||||||
|
"4": None,
|
||||||
|
"5": None,
|
||||||
|
"6": None,
|
||||||
|
"7": None,
|
||||||
|
"8": None,
|
||||||
|
"9": None,
|
||||||
|
"10": None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DefaultSponsorshipTemp(dict):
|
||||||
|
def __init__(self, user: int):
|
||||||
|
super().__init__({})
|
||||||
|
self.dict = {
|
||||||
|
"user": user,
|
||||||
|
"type": "sponsorship",
|
||||||
|
"complete": False,
|
||||||
|
"sent": False,
|
||||||
|
"state": "fill",
|
||||||
|
"stage": 1,
|
||||||
|
"sponsorship": {
|
||||||
|
"streamer": None,
|
||||||
|
"expires": datetime.fromtimestamp(0),
|
||||||
|
"proof": None,
|
||||||
|
"label": ""
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user