python - 尝试发送列表 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
解决方案
您不能从列表中调用任何参数。所以基本上,你不能使用像playlists()
. 您只需更改for x in playlists():
为for x in playlists:
.
推荐阅读
- html - 如何在容器中居中 div 元素
- oracle-apex - 在按需 ajax 进程 (PL/SQL) 中向会话提交页面项目值
- javascript - 调用另一个函数时如何禁用函数?
- css - 隐藏特定 wordpress 类别中所有帖子的 CSS 按钮
- php - 使用 symfony 中的参数执行 sql 请求时出现语法错误?
- google-bigquery - 将旧版 SQL 转换为标准 SQL - 增强型电子商务
- python-3.x - 如何使用帧单元制作 TIME 字幕(.srt、.smi 等)
- c# - 无法从另一个脚本实例化预制件
- facebook-graph-api - 获取我自己的 Instagram 帖子所需的 Graph API 权限
- python - 扩展“特定”的 defaultdict(str,...)?