dolfies / discord.py-self

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

[BUG] Changes to Online Status #76

Closed destroyace closed 3 years ago

destroyace commented 3 years ago

Summary

It appears that starting a selfbot changes my status to Online

Reproduction Steps

How did you make it happen?
  1. Start a Selfbot
  2. Status set to Online

Code

Relevant code that shows the bug.
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix=">", self_bot=True)

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

bot.run("MY_TOKEN")

Tested on two tokens just in case.

Expected Results

My current status is not changed from 'Do not Disturb', 'Idle', etc. to 'Online'

Actual Results

The following error is sent (commands work):

My status is changed to Online

System Info

Run python -m discord --version and paste the information below.
- Python v3.8.8-final
- discord.py-self v1.9.0-final
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.19041

Checklist

Let's make sure this issue is valid!

Additional Information

> MY_TOKEN refers to an actual token.
caiocinel commented 3 years ago

It turns out that when you connect the status is overwritten, and the new client becomes discord.py-self, you can set your status with

https://github.com/dolfies/discord.py-self/blob/126e4ee7f07061f678e87a4f3aadfc8b569219fd/discord/client.py#L921

destroyace commented 3 years ago

Ah, makes sense. Of course, it's cool to do it manually, but I feel like maybe the library should directly implement this? Get token's activity before startup and then set to it upon starting?

dolfies commented 3 years ago

Setting the status in IDENTIFY doesn't work for users. This was the only way.

I'll push a fix that only makes the request if you actually pass a status.

dolfies commented 3 years ago

Fixed in the latest development push.