Discord.py如何获得不是服务器成员的用户的雪花? [英] Discord.py how to get the snowflake of a user that isn't a member of the server?

查看:72
本文介绍了Discord.py如何获得不是服务器成员的用户的雪花?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

username="Testing"
BADuser = await bot.fetch_user(username)
await ctx.guild.ban(BADuser, reason="Testing", delete_message_days=0)

这是我正在使用的代码。
我收到此错误:

This is the code I'm using. I get this error:

command raised an exception: HTTPException: 400 BAD REQUEST (error code: 50035): Invalid Form Body
In user_id: Value "Testing" is not snowflake.

我不知道如何仅使用每个用户的姓名和唯一编号来获取雪花。原因是用户不在服务器上。谢谢您的帮助。

I don't know how to get the snowflake using only the name and the unique number for each user. Cause the users aren't on the server. Thank you for any help.

推荐答案

机器人无法找到无法访问的用户的ID,您需要该ID才能访问用户。您可以在此处查看此调用的文档,这是库中唯一允许您访问该机器人无法直接与其通信的用户数据的调用

The bot cannot find the ID of a user it cannot access, you need the ID to access the user. You can view the docs for this call here, and this is the only call the library has that lets you access user data that the bot cannot directly communicate with

这篇关于Discord.py如何获得不是服务器成员的用户的雪花?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆