简体   繁体   English

Discord.py 输入转换为 int()

[英]Discord.py input convert to int()

how can i convert input to int() on discord?如何在 discord 上将输入转换为 int()?

Example:例子:

input = await bot.wait_for("message")

i was try to did convert like int(answer)我试着像int(answer)那样转换

Thanks.谢谢。

Edit: Getting error TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Message'编辑:获取错误TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Message'

Here's how you can convert it to int -这是将其转换为 int 的方法 -

# Convert the input to an integer
result = int(input.content)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM