0
使用Discord.py和Im試圖在用戶輸入頻道時得到Discord用戶標識。如何使用discord.py獲取不和用戶的用戶ID
當你進入開發者模式時,可以找到用戶標識,並右鍵點擊用戶名,會出現一個選項「複製標識」。
目前API不說如何做到這一點,否則我失蹤了
使用Discord.py和Im試圖在用戶輸入頻道時得到Discord用戶標識。如何使用discord.py獲取不和用戶的用戶ID
當你進入開發者模式時,可以找到用戶標識,並右鍵點擊用戶名,會出現一個選項「複製標識」。
目前API不說如何做到這一點,否則我失蹤了
的文檔說User
類具有該用戶的ID:
http://discordpy.readthedocs.io/en/latest/api.html#user
這Member
是的子類User
:
http://discordpy.readthedocs.io/en/latest/api.html#member
所以,如果你得到了來自用戶的信息,你可以得到的ID與message.author.id
import discord
import asyncio
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
print(message.author.id)
client.run('token')
謝謝,我還有一個關於不和諧的OAuth2的問題。我試圖使用oauth2獲取用戶標識,但它沒有返回它。我正在使用這個插件 https://github.com/teamreflex/oauth2-discord –
@GibsLeFleur這是我的知識,我建議你創建另一個關於這個問題 –