Fix notes and filters for old data

This commit is contained in:
Yasir Aris M 2023-11-23 11:01:17 +07:00 committed by GitHub
parent 67ee4d677f
commit bc104e8915
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View file

@ -169,9 +169,9 @@ async def filters_re(_, message):
pattern = r"( |^|[^\w])" + re.escape(word) + r"( |$|[^\w])" pattern = r"( |^|[^\w])" + re.escape(word) + r"( |$|[^\w])"
if re.search(pattern, text, flags=re.IGNORECASE): if re.search(pattern, text, flags=re.IGNORECASE):
_filter = await get_filter(chat_id, word) _filter = await get_filter(chat_id, word)
data_type = _filter["type"] data_type = _filter.get("type")
data = _filter["data"] data = _filter.get("data")
file_id = _filter["file_id"] file_id = _filter.get("file_id")
keyb = None keyb = None
if data: if data:
if re.findall(r"\[.+\,.+\]", data): if re.findall(r"\[.+\,.+\]", data):

View file

@ -146,9 +146,9 @@ async def get_one_note(self, message):
self.log.info(_note) self.log.info(_note)
if not _note: if not _note:
return return
type = _note["type"] type_ = _note.get("type")
data = _note["data"] data = _note.get("data")
file_id = _note["file_id"] file_id = _note.get("file_id")
keyb = None keyb = None
if data: if data:
if findall(r"\[.+\,.+\]", data): if findall(r"\[.+\,.+\]", data):
@ -159,51 +159,51 @@ async def get_one_note(self, message):
if replied_message: if replied_message:
if replied_message.from_user.id != message.from_user.id: if replied_message.from_user.id != message.from_user.id:
message = replied_message message = replied_message
if type == "text": if type_ == "text":
await message.reply_text( await message.reply_text(
text=data, text=data,
reply_markup=keyb, reply_markup=keyb,
disable_web_page_preview=True, disable_web_page_preview=True,
) )
if type == "sticker": if type_ == "sticker":
await message.reply_sticker( await message.reply_sticker(
sticker=file_id, sticker=file_id,
) )
if type == "animation": if type_ == "animation":
await message.reply_animation( await message.reply_animation(
animation=file_id, animation=file_id,
caption=data, caption=data,
reply_markup=keyb, reply_markup=keyb,
) )
if type == "photo": if type_ == "photo":
await message.reply_photo( await message.reply_photo(
photo=file_id, photo=file_id,
caption=data, caption=data,
reply_markup=keyb, reply_markup=keyb,
) )
if type == "document": if type_ == "document":
await message.reply_document( await message.reply_document(
document=file_id, document=file_id,
caption=data, caption=data,
reply_markup=keyb, reply_markup=keyb,
) )
if type == "video": if type_ == "video":
await message.reply_video( await message.reply_video(
video=file_id, video=file_id,
caption=data, caption=data,
reply_markup=keyb, reply_markup=keyb,
) )
if type == "video_note": if type_ == "video_note":
await message.reply_video_note( await message.reply_video_note(
video_note=file_id, video_note=file_id,
) )
if type == "audio": if type_ == "audio":
await message.reply_audio( await message.reply_audio(
audio=file_id, audio=file_id,
caption=data, caption=data,
reply_markup=keyb, reply_markup=keyb,
) )
if type == "voice": if type_ == "voice":
await message.reply_voice( await message.reply_voice(
voice=file_id, voice=file_id,
caption=data, caption=data,