dolfies / discord.py-self

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

change_presence broken #446

Closed Auth1337 closed 1 year ago

Auth1337 commented 1 year ago

Summary

change_presence is broken doesn't work any activity

Reproduction Steps

change_presence is broken doesn't work any activity on it except discord.Game and they are working in discord.py-self 1.9.2 version.

Code

@client.event
async def on_ready():
  print("connected")
  await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="just a test"), status=discord.Status.idle)

Expected Results

expected activity as watching but nothing happened no error and only status changed to idle

Actual Results

nothing no errors, only status changed to idle

System Information

Screenshot_2023-01-27-15-08-42-72_820b80da67ca34a12f493dfc8307f092

Checklist

Additional Information

change_presence is broken doesn't work any activity on it except discord.Game and they are working in discord.py-self 1.9.2 version

Iinksafe commented 1 year ago

I recommend calling discord.Client with the activity= keyword as on_ready may be called many times.

Auth1337 commented 1 year ago

.

fw-real commented 1 year ago

guys this is still not fixed

dolfies commented 1 year ago

Unreproducible.

fw-real commented 1 year ago

Unreproducible.

image below is the code for adding the presence after making the bot online, and above you can see in the photo the presence is not added, this is only happening in the 2.0 version and the 1.9.2 works perfectly well with this code adding the presence after all the necessary activity information is provided.

import asyncio
import aiohttp
import random
import discord
import time
from discord.ext import commands

bot = commands.Bot(self_bot=True, command_prefix='!')
bot.remove_command('help')

@bot.event
async def on_ready():
    print(f'{bot.user} logged in.')
    activity = discord.Activity(name='thename', type=discord.ActivityType.playing, application_id=0000, timestamps={'start': time.time() * 1000})
    await bot.change_presence(status=discord.Status.idle, activity=activity)

bot.run("token")
fw-real commented 1 year ago

@dolfies this still hasn't been fixed

ghost commented 8 months ago

having the same issue, debug logs gave me this

When using discord.Activity():

[22/04/2023 53:04:23] [DEBUG] Sending "{"op":3,"d":{"activities":[{"flags":0,"type":0,"name":"hello world","buttons":[]}],"afk":false,"since":0,"status":"dnd"}}" to change presence.
[22/04/2023 53:04:23] [DEBUG] Dispatching event command_completion.
[22/04/2023 53:04:23] [DEBUG] Gateway event: {'t': 'SESSIONS_REPLACE', 's': 23, 'op': 0, 'd': [{'status': 'dnd', 'session_id': 'xxxxxxxxxxxxxxxxxxxxxxxx', 'client_info': {'version': 0, 'os': 'linux', 'client': 'web'}, 'activities': []}, {'status': 'dnd', 'session_id': 'xxxxxxxxxxxxxxxxxxxxxxxx', 'client_info': {'version': 0, 'os': 'windows', 'client': 'web'}, 'activities': []}]}.

When using discord.Game():

[22/05/2023 53:05:23] [DEBUG] Sending "{"op":3,"d":{"activities":[{"type":0,"name":"hello world","timestamps":{}}],"afk":false,"since":0,"status":"dnd"}}"
to change presence.
[22/05/2023 53:05:23] [DEBUG] Dispatching event command_completion.
[22/05/2023 53:05:23] [DEBUG] Gateway event: {'t': 'SESSIONS_REPLACE', 's': 27, 'op': 0, 'd': [{'status': 'dnd', 'session_id': 'all', 'client_info': {'version': 0, 'os': 'unknown', 'client': 'unknown'}, 'activities': [{'type': 0, 'timestamps': {}, 'name': 'hello world', 'id': 'xxxxxxxxxxxx'', 'created_at': 1703286377248}], 'active': True}, {'status': 'dnd', 'session_id': ''xxxxxxxxxxxxxxxxxxxxxxxx', 'client_info': {'version': 0, 'os': 'linux', 'client': 'web'}, 'activities': []}, {'status': 'dnd', 'session_id': ''xxxxxxxxxxxxxxxxxxxxxxxx'', 'client_info': {'version': 0, 'os': 'windows', 'client': 'web'}, 'activities': [{'type': 0, 'timestamps': {}, 'name': 'hello world', 'id': 'xxxxxxxxxxxx', 'created_at': 1703286377248}]}]}.