因此,有一种称为不和谐丰富存在的东西,可以显示诸如某人正在玩什么游戏(如果游戏支持的话)之类的东西()。但是,当我使用名为 pypresence 的 python 库时,Discord 中没有显示任何内容。该代码直接来自 pypresence 文档 (https://qwertyquerty.github.io/pypresence/html/info/quickstart.html)。
代码:
from pypresence import Presence
import time
client_id = 'my_client_id' # I put my client id in here, but I removed it for pretty obvious reasons
rpc = Presence(client_id)
rpc.connect()
rpc.update(state='Rich Presence using pypresence!')
while True:
time.sleep(15)
您使用的是 Discord 的测试版本吗?您可能需要手动调整所使用的管道。请参阅 pypresence.Client 或 pypresence.Presence 的
pipe
kwarg。
Iirc,默认目标管道为0,标准Discord。可能有一些自动检测,但这是我能想到的它不起作用的唯一原因。
此外,请确保在您的 Discord 设置中,必须启用“显示我正在玩的当前游戏”开关。
事实证明,这与 pypresence 无关。我忘记在“设置”>“活动状态”中打开
Display Current Activity as a Status Message
。
回溯(最近一次调用最后一次): 文件“C:\Users ugus\Documents\Use pyinstaller\Roggia.pyw”,第 10 行,位于 rpc = 存在(client_id) ^^^^^^^^^^^^^^^^^^^^ 类型错误:“模块”对象不可调用