dolfies / discord.py-self

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

selfbot crashes on new member #267

Closed lordzuku closed 2 years ago

lordzuku commented 2 years ago

Summary

selfbot

Reproduction Steps

use the selfbot rebase branch and when a new member joins the guild the bot will crash

Code

class minion(discord.Client):
    def __init__(self, config_path: str, vars_path: str, *args, **kwargs):
        self.version = "v5.0"
        self.config_path = config_path
        self.vars_path = vars_path
        with open(self.config_path) as f:
            self.configs = json.load(f)

        with open(self.vars_path) as z:
            self.var = json.load(z) 
        super().__init__(self_bot=True)

        self.ready = False

    async def on_message(self, message):
        x = messageHandler(message, self.configs, self.var, self.user)
        await x.handleMessage()

    def run(self):
        super().run(self.configs['token'])

https://media.discordapp.net/attachments/414854884488249345/957537298000535582/unknown.png?width=812&height=411

a simple try catch in threads.py appears to have fixed the issue

https://gyazo.com/d9691f35f5beb5e69517a60b4606c9c7

Expected Results

not crash

Actual Results

I belive that self.parent.parent is null, so there is no guild field

System Information

$ python -m discord -v Traceback (most recent call last): File "C:\Python39\lib\runpy.py", line 188, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "C:\Python39\lib\runpy.py", line 147, in _get_module_details return _get_module_details(pkg_main_name, error) File "C:\Python39\lib\runpy.py", line 111, in _get_module_details import(pkg_name) File "C:\Python39\lib\site-packages\discord__init.py", line 22, in from .client import * File "C:\Python39\lib\site-packages\discord\client.py", line 49, in import aiohttp File "C:\Python39\lib\site-packages\aiohttp\init__.py", line 6, in from .client import ( File "C:\Python39\lib\site-packages\aiohttp\client.py", line 35, in from . import hdrs, http, payload File "C:\Python39\lib\site-packages\aiohttp\http.py", line 1, in import http.server File "C:\Users\LordZuku\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\http.py", line 51, in from .enums import RelationshipAction, InviteType ImportError: attempted relative import with no known parent package

Checklist

Additional Information

No response

dolfies commented 2 years ago

What's the traceback?

lordzuku commented 2 years ago
https://media.discordapp.net/attachments/414854884488249345/957537298000535582/unknown.png?width=812&height=411

just have a picture of it, but that should be enough for the error, i fixed it on my local machine now, if that isnt enough info i can undo it and get u the full traceback

dolfies commented 2 years ago

tf? a thread should always have a parent channel...

dolfies commented 2 years ago

This should be fixed, if it ever existed.