Co-authored-by: AndrewLaneX <AndrewLaneX@users.noreply.github.com> Co-authored-by: Aditya <me@xditya.me> Co-authored-by: Danish <danish@ultroid.tech> Co-authored-by: buddhhu <buddhuu0@users.noreply.github.com> Co-authored-by: sppidy <sppidy@users.noreply.github.com> Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com> Co-authored-by: divkix <divkix@users.noreply.github.com> Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com> Co-authored-by: Programming Error <error@notavailable.live> Co-authored-by: New-dev0 <New-dev0@notavailable.live>
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
# 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}getaddons <raw link to code>`
|
||
Load Plugins from the given raw link.
|
||
"""
|
||
import requests
|
||
|
||
from . import *
|
||
|
||
|
||
@ultroid_cmd(pattern="getaddons ?(.*)")
|
||
async def get_the_addons_lol(event):
|
||
thelink = event.pattern_match.group(1)
|
||
xx = await eor(event, get_string("com_1"))
|
||
fool = "Please provide a raw link!"
|
||
if thelink is None:
|
||
return await eod(xx, fool, time=10)
|
||
split_thelink = thelink.split("/")
|
||
if "raw" in split_thelink or "raw.githubusercontent.com" in split_thelink:
|
||
pass
|
||
else:
|
||
return await eod(xx, fool, time=10)
|
||
name_of_it = split_thelink[(len(split_thelink) - 1)]
|
||
plug = requests.get(thelink).text
|
||
fil = f"addons/{name_of_it}"
|
||
await xx.edit("Packing the codes...")
|
||
uult = open(fil, "w", encoding="utf-8")
|
||
uult.write(plug)
|
||
uult.close
|
||
await xx.edit("Packed. Now loading the plugin..")
|
||
shortname = name_of_it.split(".")[0]
|
||
try:
|
||
load_addons(shortname)
|
||
await eod(xx, f"**Sᴜᴄᴄᴇssғᴜʟʟʏ Lᴏᴀᴅᴇᴅ** `{shortname}`", time=3)
|
||
except Exception as e:
|
||
await eod(
|
||
xx,
|
||
f"**Could not load** `{shortname}` **because of the following error.**\n`{str(e)}`",
|
||
time=3,
|
||
)
|
||
|
||
|
||
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})
|