好的,所以我的目标的基本要点是我正在尝试一个可管理的列表来帮助组织 discord 服务器中的主题名称。我的代码应该让我查看列表编辑列表并再次显示它。当我的机器人尝试发送更新的列表时,会出现此问题。这是我的代码和我的问题。
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = '/')
FreeExtras = []
@client.command()
async def Free0(ctx):
await ctx.send(FreeExtras)
@client.command()
async def addextra(ctx):
name = await client.wait_for('message',check=lambda m: m.author == ctx.author and m.channel == ctx.channel)
FreeExtras.append(name)
当我在编辑我的机器人后尝试显示列表时,会发送以下信息:
[
< code>wait_for('message')返回一个< code>Message对象,您需要通过< code >追加其< code >内容。内容
import discord
from discord.ext import commands
client = commands.Bot(command_prefix = '/')
FreeExtras = []
@client.command()
async def Free0(ctx):
await ctx.send(FreeExtras)
@client.command()
async def addextra(ctx):
global FreeExtras
name = await client.wait_for('message',check=lambda m: m.author == ctx.author and m.channel == ctx.channel)
FreeExtras.append(name.content)