首页 > 解决方案 > 尝试发送列表 Discord.py 中的项目时出错

问题描述

我试图单独发送列表中的每个项目,但如果不能这样做,那么在新行上发送每个项目也可以

这是代码

playlists = []

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    if message.author.bot: return
    if message.content == '=links':
        for x in playlists():
            await message.channel.send(x)
    if message.channel.id == 772290124117442581:
        playlists.append(message.content)
        await message.channel.send(f'Added:')
        ```await message.channel.send(f'`' + message.content + '`')

继承人的错误:

TypeError: 'list' object is not callable

标签: pythondiscorddiscord.py

解决方案


您不能从列表中调用任何参数。所以基本上,你不能使用像playlists(). 您只需更改for x in playlists():for x in playlists:.


推荐阅读