Skip to content
Advertisement

Triggering method from within a loop with Python and Pycord

I’m playing around with Pycord and trying to send a message to a channel X for each element in an array.

The following class will throw a TypeError: MyClient.on_ready() missing 1 required positional argument: 'message' indicating that MyClient.on_ready() needs 2 arguments, one for self, one for message, but every example on how to pass arguments to class methods were only sending the argument.

JavaScript

What am I missing?

EDIT: Added changes from comment, now error message reads as follow:

JavaScript

Advertisement

Answer

The error you got is because on_ready doesn’t take any arguments

Maybe something like this is what you are looking for, gets an channel object and sends an array (also subclassed just like the code you send)

JavaScript

Result : result

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement