try reconnecting, remove useless stuff
This commit is contained in:
parent
a3ee85d955
commit
eef7721153
2 changed files with 4 additions and 12 deletions
|
@ -33,9 +33,7 @@ class Gateway:
|
|||
websockets.ConnectionClosedError,
|
||||
websockets.InvalidMessage,
|
||||
):
|
||||
# TODO reconnect
|
||||
self.logger.exception("Quitting, connection lost.")
|
||||
break
|
||||
self.logger.exception("Connection lost, reconnecting.")
|
||||
|
||||
# Stop sending heartbeats until we reconnect.
|
||||
if self.heartbeat_task and not self.heartbeat_task.cancelled():
|
||||
|
@ -117,7 +115,6 @@ class Gateway:
|
|||
elif otype == "GUILD_EMOJIS_UPDATE":
|
||||
obj = discord.GuildEmojisUpdate(data)
|
||||
else:
|
||||
self.logger.info(f"Unknown OTYPE: {otype}")
|
||||
return
|
||||
|
||||
func = getattr(self, f"on_{otype.lower()}", None)
|
||||
|
|
|
@ -99,9 +99,6 @@ class MatrixClient(AppService):
|
|||
|
||||
author = self.get_members(message.room_id)[message.sender]
|
||||
|
||||
if not author.display_name:
|
||||
author.display_name = message.sender
|
||||
|
||||
webhook = self.discord.get_webhook(
|
||||
channel_id, self.discord.webhook_name
|
||||
)
|
||||
|
@ -129,7 +126,7 @@ class MatrixClient(AppService):
|
|||
webhook,
|
||||
self.mxc_url(author.avatar_url),
|
||||
message.body,
|
||||
author.display_name,
|
||||
author.display_name if author.display_name else message.sender,
|
||||
).id
|
||||
|
||||
with Cache.lock:
|
||||
|
@ -207,9 +204,7 @@ class MatrixClient(AppService):
|
|||
reference: discord.MessageReference = None,
|
||||
) -> dict:
|
||||
content = {
|
||||
# Replace single newlines with double newlines so that clients
|
||||
# render them properly.
|
||||
"body": re.sub("\\b\n\\b", "\n\n", message),
|
||||
"body": message,
|
||||
"format": "org.matrix.custom.html",
|
||||
"msgtype": "m.text",
|
||||
"formatted_body": self.get_fmt(message, emotes),
|
||||
|
@ -239,7 +234,7 @@ class MatrixClient(AppService):
|
|||
content = {
|
||||
**content,
|
||||
"body": (
|
||||
f"> <{event.sender}> {event.body}\n\n{content['body']}"
|
||||
f"> <{event.sender}> {event.body}\n{content['body']}"
|
||||
),
|
||||
"m.relates_to": {"m.in_reply_to": {"event_id": event.id}},
|
||||
"formatted_body": f"""<mx-reply><blockquote>\
|
||||
|
|
Loading…
Reference in a new issue