forked from TeamUltroid/UltroidAddons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wikipedia.py
32 lines (24 loc) · 804 Bytes
/
wikipedia.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
# Ultroid Userbot
#
# 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}wiki <search query>``
Wikipedia search from telegram.
"""
import wikipedia
from . import *
@ultroid_cmd(pattern="wiki ?(.*)")
async def wiki(e):
srch = e.pattern_match.group(1)
if not srch:
return await eor(e, "`Give some text to search on wikipedia !`")
msg = await eor(e, f"`Searching {srch} on wikipedia..`")
try:
mk = wikipedia.summary(srch)
te = f"**Search Query :** {srch}\n\n**Results :** {mk}"
await msg.edit(te)
except Exception as e:
await msg.edit(f"**ERROR** : {str(e)}")