use appendleft instead of append

Signed-off-by: EyeZiS <tabhooked@gmail.com>
This commit is contained in:
EyeZiS 2018-04-10 21:32:56 +02:00
parent 193c90336f
commit 749019141d
1 changed files with 3 additions and 3 deletions

View File

@ -46,7 +46,7 @@ def doit(chat_id, match, original):
if original is not None: if original is not None:
return actually_doit(original) return actually_doit(original)
# Try matching the last few messages # Try matching the last few messages
for original in reversed(last_msgs[chat_id]): for original in last_msgs[chat_id]:
m, s = actually_doit(original) m, s = actually_doit(original)
if s is not None: if s is not None:
return m, s return m, s
@ -61,7 +61,7 @@ async def group_has_regex(group):
@borg.on(events.NewMessage) @borg.on(events.NewMessage)
async def on_message(event): async def on_message(event):
chat_id = utils.get_peer_id(await event.input_chat) chat_id = utils.get_peer_id(await event.input_chat)
last_msgs[chat_id].append(event.message) last_msgs[chat_id].appendleft(event.message)
@borg.on(events.NewMessage( @borg.on(events.NewMessage(
@ -78,7 +78,7 @@ async def on_regex(event):
if m is not None: if m is not None:
out = await borg.send_message(await event.input_chat, s, reply_to=m.id) out = await borg.send_message(await event.input_chat, s, reply_to=m.id)
last_msgs[chat_id].append(out) last_msgs[chat_id].appendleft(out)
elif s is not None: elif s is not None:
await event.reply(s) await event.reply(s)