the order matters
This commit is contained in:
parent
06a242470b
commit
5a06a6baab
|
@ -20,16 +20,19 @@ nest_asyncio.apply()
|
||||||
rooms = dict()
|
rooms = dict()
|
||||||
global_bot = None
|
global_bot = None
|
||||||
|
|
||||||
|
send_entry_lock = asyncio.Lock()
|
||||||
|
|
||||||
|
|
||||||
async def send_entry(blob, content_type, fmt_params, rooms):
|
async def send_entry(blob, content_type, fmt_params, rooms):
|
||||||
for room_id in rooms:
|
async with send_entry_lock:
|
||||||
room = MatrixRoom(room_id=room_id, own_user_id=os.getenv("BOT_OWNERS"),
|
for room_id in rooms:
|
||||||
encrypted=rooms[room_id])
|
room = MatrixRoom(room_id=room_id, own_user_id=os.getenv("BOT_OWNERS"),
|
||||||
if blob and content_type:
|
encrypted=rooms[room_id])
|
||||||
await global_bot.upload_and_send_image(room, blob, text="", blob=True, blob_content_type=content_type)
|
if blob and content_type:
|
||||||
|
await global_bot.upload_and_send_image(room, blob, text="", blob=True, blob_content_type=content_type)
|
||||||
|
|
||||||
await global_bot.send_html(room, msg_template_html.format(**fmt_params),
|
await global_bot.send_html(room, msg_template_html.format(**fmt_params),
|
||||||
msg_template_plain.format(**fmt_params))
|
msg_template_plain.format(**fmt_params))
|
||||||
|
|
||||||
|
|
||||||
def get_image(img=None, width=1000, height=1500):
|
def get_image(img=None, width=1000, height=1500):
|
||||||
|
|
Loading…
Reference in New Issue