首页 > 解决方案 > 我想在 python 中使用 asycnio 在输入时打印一些东西

问题描述

我正在使用 python 进行聊天。我正在使用不和谐并从那里获取输入。我希望用户始终处于发送模式,但也能够随时阅读消息。

from discord.ext import commands
import asyncio

bot = commands.Bot("!")

username = input("your display name: ")
@bot.event
async def on_ready():
    print('successfully logged in as {}'.format(username))

@bot.command()
async def message(ctx, author, receiver, context):
    if (receiver == username):
        print("{}: {}".format(author, context))
        #i want this to be printed while taking input

#and i cant take input using normal input()

bot.run("my token")

我对python只有基本的了解,所以请不要评判我。

标签: pythondiscordchatpython-asyncio

解决方案


我现在明白这是不可能的谢谢


推荐阅读