Exemple #1
0
async def get_the_addons_lol(event):
    thelink = event.pattern_match.group(1)
    xx = await event.eor(get_string("com_1"))
    fool = get_string("gas_1")
    if thelink is None:
        return await xx.eor(fool, time=10)
    split_thelink = thelink.split("/")
    if "raw" not in thelink:
        return await xx.eor(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...")
    with open(fil, "w", encoding="utf-8") as uult:
        uult.write(plug)
    await xx.edit("Packed. Now loading the plugin..")
    shortname = name_of_it.split(".")[0]
    try:
        load_addons(shortname)
        await xx.eor(get_string("core_17").format(shortname), time=15)
    except Exception as e:
        await eod(
            xx,
            get_string("core_18").format(shortname, e),
            time=3,
        )
Exemple #2
0
async def load(event):
    shortname = event.pattern_match.group(1)
    if not shortname:
        await event.eor(get_string("core_16"))
        return
    try:
        try:
            un_plug(shortname)
        except BaseException:
            pass
        load_addons(shortname)
        await event.eor(get_string("core_17").format(shortname), time=3)
    except Exception as e:
        await eod(
            event,
            get_string("core_18").format(shortname, e),
            time=3,
        )