forked from TeamUltroid/UltroidAddons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
animedb.py
37 lines (30 loc) · 1004 Bytes
/
animedb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Made by : @Arnab431 || github.com/ArnabXD
# Made For : https://github.com/TeamUltroid/UltroidAddons
"""
Search animes and manga from anilist.co using @animedb_bot
✘ Commands Available
• `{i}manga <keyword>`
To get manga info
"""
from telethon.errors import ChatSendInlineForbiddenError
from . import *
INLOCK = "`Seems like inline messages aren't allowed here`"
@ultroid_cmd(
pattern="manga ?(.*)",
)
async def manga(ult):
msg = await eor(ult, "`Searching ...`")
keyword = ult.pattern_match.group(1)
if keyword is None:
return await msg.edit("`Provide a Keyword to search`")
try:
animes = await ult.client.inline_query("animedb_bot", f"<m> {keyword}")
await animes[0].click(
ult.chat_id,
reply_to=ult.reply_to_msg_id,
silent=True if ult.is_reply else False,
hide_via=True,
)
return await msg.delete()
except Exception:
return await msg.edit("`No Results Found ...`")