forked from TeamUltroid/Ultroid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub.py
70 lines (60 loc) · 1.68 KB
/
github.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 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}github <username>`
Get full information of the users github profile.
"""
import requests
from . import *
@ultroid_cmd(
pattern="github (.*)",
)
async def gitsearch(event):
xx = await eor(event, "`Searching...`")
try:
usrname = event.pattern_match.group(1)
except BaseException:
return await xx.edit("`Search for whom? Give me a user name!!`")
url = f"https://api.github.com/users/{usrname}"
ult = requests.get(url).json()
try:
uname = ult["login"]
uid = ult["id"]
upic = ult["avatar_url"]
ulink = ult["html_url"]
uacc = ult["name"]
ucomp = ult["company"]
ublog = ult["blog"]
ulocation = ult["location"]
ubio = ult["bio"]
urepos = ult["public_repos"]
ufollowers = ult["followers"]
ufollowing = ult["following"]
except BaseException:
return await xx.edit("`No such user found...`")
fullusr = f"""
**[GITHUB]({ulink})**
**Name** - {uacc}
**UserName** - {uname}
**ID** - {uid}
**Company** - {ucomp}
**Blog** - {ublog}
**Location** - {ulocation}
**Bio** - {ubio}
**Repos** - {urepos}
**Followers** - {ufollowers}
**Following** - {ufollowing}
"""
await xx.delete()
await ultroid_bot.send_file(
event.chat_id,
upic,
caption=fullusr,
link_preview=False,
)
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=Var.HNDLR)}"})