smal: e2eesetup cleanup
This commit is contained in:
parent
ce6ed0977e
commit
c772abf8b3
2 changed files with 5 additions and 20 deletions
|
|
@ -4,14 +4,7 @@ import logging
|
|||
from mxsmal.bot import SMALBot
|
||||
from pygomx.apiv0 import ApiV0Api
|
||||
|
||||
# setup logging, we want timestamps
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
format="%(asctime)s.%(msecs)03d %(levelname)s %(name)s - %(funcName)s: %(message)s",
|
||||
datefmt="%Y-%m-%d %H:%M:%S",
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(level=logging.INFO)
|
||||
|
||||
|
||||
# TODO this should be an App, not a Bot
|
||||
|
|
@ -21,10 +14,7 @@ class E2eeBot(SMALBot):
|
|||
super().__init__("¿")
|
||||
|
||||
async def on_startup(self):
|
||||
print("e2eeBot started.")
|
||||
res = ApiV0Api.self_sign(self.client_id)
|
||||
print(res)
|
||||
print("e2eeBot done?.")
|
||||
ApiV0Api.self_sign(self.client_id)
|
||||
|
||||
async def on_sys(self, ntf):
|
||||
print("Got a system notification: ", ntf)
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
# Copyright (C) 2026 saces@c-base.org
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
from datetime import datetime
|
||||
import getpass
|
||||
import os
|
||||
import json
|
||||
from datetime import datetime
|
||||
from functools import partial, wraps
|
||||
|
||||
import click
|
||||
from pygomx.errors import PygomxAPIError
|
||||
|
||||
from pygomx.apiv0 import ApiV0
|
||||
from pygomx.cliv0 import CliV0
|
||||
from pygomx.errors import PygomxAPIError
|
||||
|
||||
from .e2eebot import E2eeBot
|
||||
|
||||
|
|
@ -55,11 +51,10 @@ def e2eesetup(mxpassfile):
|
|||
click.echo("Other devices:")
|
||||
other_devices_list = []
|
||||
for device in devices["devices"]:
|
||||
# print(device)
|
||||
if device["device_id"] != whoami["device_id"]:
|
||||
other_devices_list.append(device["device_id"])
|
||||
# devices never logged in don't have a 'last_seen_ts'
|
||||
last_seen = ""
|
||||
last_seen = "never"
|
||||
if device["last_seen_ts"]:
|
||||
last_seen = datetime.fromtimestamp(device["last_seen_ts"] / 1000)
|
||||
click.echo(
|
||||
|
|
@ -95,4 +90,4 @@ def e2eesetup(mxpassfile):
|
|||
|
||||
e2eeBot.run(sync=False)
|
||||
|
||||
print("Huhu Bämm!")
|
||||
click.echo("e2ee setup done. you may start your bot now.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue