Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 92830c3a64 | |||
| 00faab2213 | |||
| d6294ebb45 |
@@ -1,2 +1,2 @@
|
|||||||
__version__ = "0.6.0"
|
__version__ = "0.6.1rc1"
|
||||||
__author__ = "Tulir Asokan <tulir@maunium.net>"
|
__author__ = "Tulir Asokan <tulir@maunium.net>"
|
||||||
|
|||||||
@@ -170,7 +170,9 @@ class MatrixParser:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def node_to_tmessage(cls, node: HTMLNode, ctx: RecursionContext) -> TelegramMessage:
|
def node_to_tmessage(cls, node: HTMLNode, ctx: RecursionContext) -> TelegramMessage:
|
||||||
if node.tag == "ol":
|
if node.tag == "mx-reply":
|
||||||
|
return TelegramMessage("")
|
||||||
|
elif node.tag == "ol":
|
||||||
return cls.list_to_tmessage(node, ctx)
|
return cls.list_to_tmessage(node, ctx)
|
||||||
elif node.tag == "ul":
|
elif node.tag == "ul":
|
||||||
return cls.list_to_tmessage(node, ctx.enter_list())
|
return cls.list_to_tmessage(node, ctx.enter_list())
|
||||||
|
|||||||
@@ -346,7 +346,10 @@ class Portal:
|
|||||||
await self.invite_to_matrix(invites or [])
|
await self.invite_to_matrix(invites or [])
|
||||||
return self.mxid
|
return self.mxid
|
||||||
async with self._room_create_lock:
|
async with self._room_create_lock:
|
||||||
return await self._create_matrix_room(user, entity, invites)
|
try:
|
||||||
|
return await self._create_matrix_room(user, entity, invites)
|
||||||
|
except Exception:
|
||||||
|
self.log.exception("Fatal error creating Matrix room")
|
||||||
|
|
||||||
async def _create_matrix_room(self, user: 'AbstractUser', entity: TypeChat, invites: InviteList
|
async def _create_matrix_room(self, user: 'AbstractUser', entity: TypeChat, invites: InviteList
|
||||||
) -> Optional[MatrixRoomID]:
|
) -> Optional[MatrixRoomID]:
|
||||||
|
|||||||
@@ -161,6 +161,12 @@ class User(AbstractUser):
|
|||||||
# endregion
|
# endregion
|
||||||
# region Telegram connection management
|
# region Telegram connection management
|
||||||
|
|
||||||
|
async def try_ensure_started(self) -> None:
|
||||||
|
try:
|
||||||
|
await self.ensure_started()
|
||||||
|
except Exception:
|
||||||
|
self.log.exception("Exception in ensure_started")
|
||||||
|
|
||||||
def ensure_started(self, even_if_no_session=False) -> Awaitable['User']:
|
def ensure_started(self, even_if_no_session=False) -> Awaitable['User']:
|
||||||
return super().ensure_started(even_if_no_session)
|
return super().ensure_started(even_if_no_session)
|
||||||
|
|
||||||
@@ -400,9 +406,9 @@ class User(AbstractUser):
|
|||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
|
|
||||||
def init(context: 'Context') -> List[Awaitable['User']]:
|
def init(context: 'Context') -> List[Awaitable[None]]:
|
||||||
global config
|
global config
|
||||||
config = context.config
|
config = context.config
|
||||||
|
|
||||||
users = [User.from_db(user) for user in DBUser.all()]
|
users = [User.from_db(user) for user in DBUser.all()]
|
||||||
return [user.ensure_started() for user in users if user.tgid]
|
return [user.try_ensure_started() for user in users if user.tgid]
|
||||||
|
|||||||
Reference in New Issue
Block a user