import discord
TOKEN = "my token"
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
async def on_message(self, message):
# don't respond to ourselves
if message.author == self.user:
return
if message.content == 'cocacola':
await message.channel.send('cocacola espuma')
client = MyClient()
client.login(TOKEN)
and I get this error:
Warning (from warnings module): File "C:/Users/Aorus/AppData/Local/Programs/Python/Python36/discbot.py", line 20 client.login(TOKEN) RuntimeWarning: coroutine 'Client.login' was never awaited
Do client.run(TOKEN)
and not client.login(TOKEN)
on the last line.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.