mirror of
https://github.com/luk3yx/miniirc_matrix.git
synced 2026-05-17 05:25:44 +03:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a0d644b60 | ||
|
|
c184810355 | ||
|
|
af6a763c14 |
@@ -12,7 +12,7 @@ import functools, html.parser, itertools, json, math, re, threading, time, uuid
|
||||
import miniirc, requests, traceback # type: ignore
|
||||
|
||||
|
||||
ver = (0, 0, 5)
|
||||
ver = (0, 0, 8)
|
||||
__version__ = '.'.join(map(str, ver))
|
||||
|
||||
|
||||
@@ -398,7 +398,7 @@ class Matrix(miniirc.IRC):
|
||||
# Non-SSL localhost connections are probably to
|
||||
# https://github.com/matrix-org/pantalaimon which doesn't support
|
||||
# the "v3" URLs yet.
|
||||
matrix_url = f'http://{hostname}'
|
||||
baseurl = f'http://{hostname}'
|
||||
api_version = 'r0'
|
||||
else:
|
||||
api_version = 'v3'
|
||||
@@ -495,6 +495,14 @@ class Matrix(miniirc.IRC):
|
||||
if self.debug_file:
|
||||
self.debug(json.dumps(res, indent=4))
|
||||
if 'error' in res:
|
||||
# TODO: Use self.debug or something
|
||||
print(f'[miniirc_matrix] Error returned when trying to '
|
||||
f'fetch /sync: {res["error"]!r}')
|
||||
|
||||
if self.persist:
|
||||
self.debug('Trying again in 15 seconds...')
|
||||
time.sleep(15)
|
||||
continue
|
||||
break
|
||||
next_batch = res['next_batch']
|
||||
if 'rooms' in res:
|
||||
@@ -520,8 +528,9 @@ class Matrix(miniirc.IRC):
|
||||
@_room_processor('join', 'leave')
|
||||
def __process_join(self, room_id: str, room: dict[str, Any]) -> None:
|
||||
# Joined rooms
|
||||
for raw_event in room['timeline']['events']:
|
||||
self.__fire_event(room_id, _Event(raw_event))
|
||||
if 'timeline' in room:
|
||||
for raw_event in room['timeline']['events']:
|
||||
self.__fire_event(room_id, _Event(raw_event))
|
||||
|
||||
@_room_processor('invite')
|
||||
def __process_invite(self, room_id: str, room: dict[str, Any]) -> None:
|
||||
|
||||
Reference in New Issue
Block a user