forked from TeamUltroid/UltroidAddons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
quotefancy.py
34 lines (27 loc) · 880 Bytes
/
quotefancy.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
# Ultroid - UserBot
# Copyright (C) 2020 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
"""
✘ Commands Available
• `{i}qfancy`
Gets random quotes from QuoteFancy.com.
"""
from quotefancy import get_quote
from telethon.errors import ChatSendMediaForbiddenError
from . import *
@ultroid_cmd(pattern="qfancy$")
async def quotefancy(e):
mes = await eor(e, "`Processing...`")
img = get_quote("img", download=True)
try:
await e.client.send_file(e.chat_id, img)
os.remove(img)
await mes.delete()
except ChatSendMediaForbiddenError:
quote = get_quote("text")
await eor(e, f"`{quote}`")
except Exception as e:
await eor(e, f"**ERROR** - {str(e)}")