dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
665 stars 155 forks source link

very long module execution time #489

Closed MuzuWeb closed 1 year ago

MuzuWeb commented 1 year ago

Summary

very long module execution time

Reproduction Steps

I'm actually coding a discord selfbot and every time I start the script it takes at least 3 or 4 minutes to be fully executed, is there any solution for that ?

Code

#modules

import discord
import sys
import traceback
import aiohttp
import random
import asyncio
import datetime
import os
import urlextract
import requests
from discord import Embed
import json
import subprocess
import platform
import psutil
import json
from termcolor import colored
import time 
from discord.ext import commands
import os
import time
import json
import whois
from io import BytesIO
from PIL import Image
import logging

#variables

with open('settings/data.json', 'r') as f:
    data = json.load(f)

token = data['token']
webhookerror = data['webhookerror']
webhooklogs = data['webhooklogs']
salon_id = data['salon_id']
compte_id = data['compte_id']

bot = commands.Bot(command_prefix="&", self_bot=True)
bot.remove_command('help')
anti_group_enabled = False
antifriend_active = False
js_process = None

#events

@bot.event
async def on_ready():
    #os.system('cls' if os.name == 'nt' else 'clear')
    link = bot.user.avatar
    headers = {"Content-Type": "application/json"}
    data = {"username": bot.user.name,"pfp_link": link}
    async with aiohttp.ClientSession(headers=headers) as session:
        async with session.post("https://core-client-api.xcoreproject.repl.co/api/notifier", json=data):
            pass
    print('User: ' + bot.user.name)

@bot.event
async def send_error_log(error_msg):
    data = {"content": f"<@{compte_id}> Error occurred:{error_msg}```"}
    requests.post(url=webhookerror, json=data)

bot.run(token)

Expected Results

I was excepting getting my selfbot immediatly operationnal

Actual Results

I need to wait 3 or 4 minutes just to debug

System Information

Checklist

Additional Information

No response

dolfies commented 1 year ago

Please update to release v2.0.0. v1.x is no longer supported. If you're still seeing slow load on v2, consider the options chunk_guilds_at_startup=False or request_guilds=False.