Log resets/votes

Signed-off-by: Ari Archer <ari.web.xyz@gmail.com>
This commit is contained in:
Ari Archer 2022-07-17 12:07:29 +03:00
parent a36c31bad6
commit 4861b93e44
Signed by untrusted user who does not match committer: ari
GPG key ID: A50D5B4B599AF8A2

View file

@ -60,7 +60,7 @@ CONFIG: Dict[str, Any] = {
"aliases": {},
"report-webhook-url": "",
"authkey-webhook-url": "",
"chatlog-limit": 150,
"chatlog-limit": 500,
}
RANDOM: SystemRandom = SystemRandom()
@ -76,6 +76,12 @@ def gen_key() -> str:
GUAC_CACHE: Dict[str, Dict[Any, Any]] = {"guac": {}, "unguac": {}}
AUTH: Dict[str, Any] = {"users": set(), "key": gen_key()}
STATE: Dict[str, Any] = {"run": True, "vm": "", "chatlog": []}
VOTE_STATES: Dict[int, str] = {
0: "Vote started",
1: "Someone voted/removed their vote",
2: "Reset vote ended",
3: "Timeout for reset",
}
def paste(content: str, no_content_msg: str) -> Union[str, Tuple[None, str]]:
@ -832,6 +838,15 @@ class MessageParser:
return cls.type_nop(content)
@classmethod
def type_vote(cls, content: List[str]) -> Tuple[str]:
chatlog_entry(
f"{VOTE_STATES.get(int(content[0])) or 'Unknown vote type'}: {' '.join(content)}",
"Server",
"RESET",
)
return cls.type_nop(content)
async def main() -> int:
"""Entry/main function"""