Discord.py Cogs 最多接受 2 个参数
Discord.py Cogs take at most 2 arguments
当我尝试为我的机器人添加一个 Cog 时,它给我一个 TypeError
module() takes at most 2 arguments (3 given)
class Commands(commands.cog):
def __init__(self, client):
self.client = client
self.song_queue = {}
self.setup()
def setup(self):
for guild in self.client.guilds():
self.song_queue[guild.id] = []
我也是用
设置的
async def setup():
client.add_cog(Commands(client))
client.loop.create_task(setup())
guilds
是一个列表,你不能调用它,而且self.client.guilds
永远是空的,你需要找到另一种方式来设置机器人在“准备好” -
拓
当我尝试为我的机器人添加一个 Cog 时,它给我一个 TypeError
module() takes at most 2 arguments (3 given)
class Commands(commands.cog):
def __init__(self, client):
self.client = client
self.song_queue = {}
self.setup()
def setup(self):
for guild in self.client.guilds():
self.song_queue[guild.id] = []
我也是用
设置的async def setup():
client.add_cog(Commands(client))
client.loop.create_task(setup())
guilds
是一个列表,你不能调用它,而且self.client.guilds
永远是空的,你需要找到另一种方式来设置机器人在“准备好” -
拓