dolfies / discord.py-self

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

Bot stalls #185

Closed rayzchen closed 2 years ago

rayzchen commented 2 years ago

Summary

Running bot.run does nothing, keyboardinterrupt doesnt raise exception

Reproduction Steps

New venv, installed discord.py-self and discord.py, ran script

Code

import discord
from discord.ext import commands

bot = commands.Bot(command_prefix='\a', self_bot=True)

@bot.event
async def on_ready():
    print("Bot is ready")

@bot.command()
async def ping(ctx):
    await ctx.send('pong')

bot.run("token")

Expected Results

Bot logs in, prints "Bot is ready"

Actual Results

Nothing

System Information

Checklist

Additional Information

using 2fa (i made a selfbot without discord.py-self and it worked with the same token, just couldn't read any message embeds)

TheOnlyWayUp commented 2 years ago

Hey, 1.9.1 is not being updated anymore. Could you try with the rebase branch and let us know how it goes?

Uninstall discord.py-self and run the following command -

python3.9 -m pip install git+https://github.com/dolfies/discord.py-self@rebase

Or, you could git clone the repository and could move the 'Discord' directory to your CWD without having to uninstall anything.

TheOnlyWayUp commented 2 years ago

And, this could also occur because the bot is caching information, how many servers is your selfbot in? To disable guild caching -

from discord import GuildSubscriptionOptions
bot = commands.Bot(command_prefix='\a', self_bot=True, guild_subscription_options=GuildSubscriptionOptions.off())

Let us know how this goes, disabling caching makes it so that

bot.get_guild(id)

And such won't work, instead, you'll have to do

await bot.fetch_guild(id)
rayzchen commented 2 years ago

Thanks, I'll try it out.

dolfies commented 2 years ago

Yeah, it looks like the subscriptions are the problem. However, if you disable them bot.get_guild() still works, but guild.members won't be filled.

rayzchen commented 2 years ago

And, this could also occur because the bot is caching information, how many servers is your selfbot in? To disable guild caching -

from discord import GuildSubscriptionOptions
bot = commands.Bot(command_prefix='\a', self_bot=True, guild_subscription_options=GuildSubscriptionOptions.off())

Let us know how this goes, disabling caching makes it so that

bot.get_guild(id)

And such won't work, instead, you'll have to do

await bot.fetch_guild(id)

Now GuildSubscriptionOptions cannot be imported from discord, still using the latest version of discord.py-self from the rebase branch

dolfies commented 2 years ago

GuildSubscriptionOptions are gone. The library now "chunks" the guilds it can (which is much faster) and can be controlled with the old chunk_guilds_at_startup parameter. Still recommend setting to False if you don't need guild members/member events.

Additionally, the rebase branch has been merged into master and is no longer developed on.

rayzchen commented 2 years ago

Oh, ok thanks.