Discord.py: TypeError: event() missing 1 required positional argument: 'coro'

Created on 24 Jun 2018  路  1Comment  路  Source: Rapptz/discord.py

I didn't get it...


C:\Users\WxyLife_\PycharmProjects\WxyBot\venv\Scripts\python.exe C:/Users/WxyLife_/PycharmProjects/WxyBot/main.py
Traceback (most recent call last):
File "C:/Users/WxyLife_/PycharmProjects/WxyBot/main.py", line 10, in
@asyncio.coroutine
TypeError: event() missing 1 required positional argument: 'coro'

Process finished with exit code 1


import asyncio as asyncio
import discord

import SECRETS

client = discord.Client

@client.event
@asyncio.coroutine
async def on_ready():
print("--------------------------------")
print("Der WxyBot wurde gestartet.")
print("Version 0.1")
print("Made by Nutzloses Wesen.#8038")
print("Auf folgenden Server zu finden:\n")
for s in client.servers:
print(" - %s (%s)" % (s.name, s.id))
print("--------------------------------")

client.run(SECRETS.TOKEN)


Or i'm just stupid... ._.

question

Most helpful comment

This is erroring because you're initializing client as the Client class itself instead of an instance of it, with discord.Client().
Also, import asyncio as asyncio is unnecessarily redundant, as is @asyncio.coroutine when you're already defining on_ready as a coroutine with async def.

For future questions like this, you should join either the official discord.py server or the Discord API server for help, as the README recommends.

>All comments

This is erroring because you're initializing client as the Client class itself instead of an instance of it, with discord.Client().
Also, import asyncio as asyncio is unnecessarily redundant, as is @asyncio.coroutine when you're already defining on_ready as a coroutine with async def.

For future questions like this, you should join either the official discord.py server or the Discord API server for help, as the README recommends.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

j0hnmeow picture j0hnmeow  路  3Comments

synbitz picture synbitz  路  3Comments

Rimmy50 picture Rimmy50  路  3Comments

Nicba1010 picture Nicba1010  路  3Comments

Be4Vision picture Be4Vision  路  3Comments