I wanted to make a bot that I can chat with my friends through the bot without needing to open discord. I tried sending messages by getting user input but while waiting for the input it can't print my friends messages at the same time. I tried to use threading but it doesn't seem to work.
Is there any way to do this? ,this is my code.
import discord
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
username = str(message.author).split('#')[0]
usermessage = str(message.content)
channel = str(message.channel.name)
while True:
if message.author == client.user:
return
print(username,':',usermessage)
answer = input('You: ')
await message.channel.send(answer)
if usermessage == message.content:
return
client.run('TOKEN')
If someone sends stacked messages before I reply it can only get one reply per message I send. Is there any way for it to keep printing messages from discord before I reply?