【发布时间】:2021-08-07 20:35:34
【问题描述】:
我正在尝试这样做,以便您可以在命令后从特定通道获取用户输入,然后机器人将用户输入发送到不同的通道。谁能告诉我我犯的任何错误以及如何修复它们,因为我的代码似乎不起作用?我最近才开始使用 discord.py 重写。
import discord
import os
from discord.ext import commands
client = commands.Bot(command_prefix=">")
@client.command()
async def resus(ctx):
await ctx.send("To reserve a username type - user (your discord tag) (the username you want) (if you want verification)")
def check(msg):
return msg.channel.id == 873501773971726346
msg = await client.wait_for("message", check=check)
if msg.content.lower() == msg.content.lower():
qwerty = bot.get_channel(873564203535958047)
await qwerty.send(f"{msg}")
else:
await ctx.send("There has been a problem, please try again.")
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
client.run(os.getenv('TOKEN'))
【问题讨论】:
-
请修复缩进,我们应该将您的代码复制并粘贴到 python 文件中并在没有语法/缩进错误的情况下运行它。
标签: python python-3.x discord.py user-input