2
0
mirror of https://github.com/Nick80835/microbot synced 2025-08-31 22:46:01 +00:00

add a function to loader for checking if a sticker is a sticker

This commit is contained in:
Nick80835
2020-12-04 20:25:31 -05:00
parent 8dbf05ba8c
commit a0cd71a29e
2 changed files with 14 additions and 5 deletions

View File

@@ -4,8 +4,8 @@ from importlib import import_module, reload
from os.path import basename, dirname, isfile
from aiohttp import ClientSession
from telethon.tl.types import DocumentAttributeFilename
from telethon.tl.types import (DocumentAttributeFilename,
DocumentAttributeSticker)
from .cache import Cache
from .command import (CallbackQueryCommand, Command, InlineArticleCommand,
@@ -171,6 +171,15 @@ class Loader():
else:
return
async def is_sticker(self, event) -> bool:
if event and event.sticker:
attrs = [i.alt for i in event.sticker.attributes if isinstance(i, DocumentAttributeSticker)]
if attrs and attrs[0]:
return True
return False
def prefix(self):
return (self.settings.get_list('cmd_prefix') or ['.'])[0]