async def install(self, event): reply = await event.get_reply_message() text = await event.reply("Processing...") await event.delete() hmm = await event.client.download_media(reply, self.xconfig["directory"]) path = Path(hmm) try: start_module(path.stem.replace(".py", "")) except Exception as e: await utils.answer(text, str(e), call="edit") return await utils.answer(text, self.xconfig["installed message"][0], call="edit")
async def dlmod(self, event): await utils.answer(event, "Processing Module...") url = event.text.split(" ")[1] response = requests.get(url) file_name = url.split("/")[-1] t_file = open(self.xconfig["directory"][0] + file_name, "w") t_file.write(response.text) t_file.close() start_module(file_name.split(".")[0]) await utils.answer( event, self.xconfig["installed message"][0] + f"\nModule is {file_name}")
# GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. from xtrabot import client from sys import argv import sys from telethon.errors.rpcerrorlist import PhoneNumberInvalidError import os from pathlib import Path import glob from xtrabot.xtrautil import start_module client.start() path = 'xtrabot/modules/*.py' files = glob.glob(path) for name in files: with open(name) as f: path1 = Path(f.name) shortname = path1.stem start_module(shortname.replace(".py", "")) print("Your Userbot Is Working.") if len(argv) not in (1, 3, 4): client.disconnect() else: client.run_until_disconnected()