Merge Beta with Stable releases #1

Merged
profitroll merged 52 commits from dev into master 2022-12-16 16:14:41 +02:00
Showing only changes of commit d4256f0c8c - Show all commits

View File

@ -100,7 +100,7 @@ class HoloUser():
voice: Union[str, Voice, None] = None,
adm_origin: bool = False,
adm_context: bool = False
):
) -> None:
"""Send a message to user
### Args:
@ -210,7 +210,7 @@ class HoloUser():
logWrite(f"Could not notify admin about failure when sending message! Admin has never interacted with bot!")
await context.reply_text(locale("message_error", "message"), quote=should_quote(context))
async def set_label(self, chat: Chat, label: str):
async def set_label(self, chat: Chat, label: str) -> None:
"""Set label in destination group
### Args:
@ -223,7 +223,7 @@ class HoloUser():
if (not await isAnAdmin(self.id)) and (chat.id == configGet("admin_group")):
await app.set_administrator_title(configGet("destination_group"), self.id, label)
async def reset_label(self, chat: Chat):
async def reset_label(self, chat: Chat) -> None:
"""Reset label in destination group
### Args:
@ -238,13 +238,20 @@ class HoloUser():
))
def application_state(self) -> tuple[Literal["none", "fill", "approved", "rejected"], bool]:
"""Check the current state of application in tmp collection
### Returns:
* `tuple[Literal["none", "fill", "approved", "rejected"], bool]`: First element is an enum of a state and the second one is whether application is complete.
"""
tmp_application = col_tmp.find_one({"user": self.id, "type": "application"})
if tmp_application is None:
return "none", False
else:
return tmp_application["state"], tmp_application["complete"]
def application_restart(self):
def application_restart(self) -> None:
"""Reset application of a user in tmp collection and replace it with an empty one
"""
doc = {
"user": self.id,
"type": "application",
@ -272,7 +279,13 @@ class HoloUser():
col_tmp.delete_one({"user": self.id, "type": "application"})
col_tmp.insert_one(document=doc)
async def application_next(self, query: str, msg: Union[Message, None] = None):
async def application_next(self, query: str, msg: Message) -> None:
"""Move on filling application of user
### Args:
* query (`str`): Some kind of input
* msg (`Message`): Message that should receive replies
"""
if col_tmp.find_one({"user": self.id, "type": "application"}) is None: