dolfies / discord.py-self

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

Selfbot self.button(click) wont work on large server. #631

Open loxlet opened 6 months ago

loxlet commented 6 months ago

Summary

self.button(click) wont work on large server, but work flawlessly on small server

Reproduction Steps

run selfbot , button self click works on small server but 400 bad request on larger sever.

Code

if isbutton(cid):
# dprint(f"{Fore.LIGHTRED_EX}Button Data: {buttons[0]}")
   await self.wait_for("message_edit", check=mcheck)
   await self.buttons[0].click()
   await self.afterclick()

Expected Results

the button clicked

Actual Results

[2023-12-18 02:49:02] [ERROR ] discord.client: Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\Dhinotea\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\client.py", line 600, in _run_event await coro(*args, kwargs) File "C:\abc\main.py", line 223, in on_message await self.buttons[1].click() File "C:\Users\Dhinotea\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\components.py", line 243, in click return await _wrapped_interaction( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Dhinotea\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\interactions.py", line 203, in _wrapped_interaction await state.http.interact(type, data, channel, nonce=nonce, kwargs) File "C:\Users\Dhinotea\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 930, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In data: Component validation failed

System Information

Checklist

Additional Information

sometimes it works on large server, like 1 out of 1000 times. but on small server it works every single time.

FrostX-Official commented 3 months ago

+1, having the same issue with UnbelievaBoat buttons on a huge server

astolfoismywaifu commented 3 months ago

@FrostX-Official Hes referring to my project here and for me it was an issue with my code or maybe just the way discord works but I pretty much had to add a check to see if the buttons were disabled.

def mcheck(before, after):
    if before.id == message.id and not after.components[0].children[0].disabled:
        self.buttons = after.components[0].children
        return True
    else:
        return False
await self.wait_for("message_edit", check=mcheck)
await self.buttons[0].click()

After adding not after.components[0].children[0].disabled it works just fine