Beispiel #1
0
def append_chat(chat_id):
    """
    Append chat unless it haven't been used
    :param chat_id: Telegram chat id
    :return: unique chat hash (as route)
    """
    try:
        chat = Chat.get((Chat.chat_id == chat_id))
        hash = chat.hash
    except Chat.DoesNotExist:
        hash = generate_hash()
        chat = Chat.create(hash=hash, chat_id=chat_id, notifications_mask=255)
        chat.save()
    return hash
Beispiel #2
0
 def debug(self) -> None:
     """Showcase of 128-bit hash generation."""
     print(generate_hash())