0
votes

Ok so the basic jist of my goal is that I'm trying to me a manageable list to help organize theme names in a discord server. My code should let me look at a list edit the list and show it again. The issue comes in when my bot tries to send the updated list through. Here's my code and my issue.

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)

When I try to show the list after editing my bot sends this:

[<Message id=804880602042073118 channel= type=<MessageType.default: 0> author=<Member id=306814779358445570 name='Gundamn' discriminator='0657' bot=False nick=None guild=> flags=>]

1
For Free0 to work, I think you have to convert the list to a string, use str(FreeExtras) instead of FreeExtras inside the send() function. It looks like the message being send is a discord.Message object and not the content, however it looks like you haven't posted the function for that command. You'll have to get the content from the object using Message.content.Sujit

1 Answers

1
votes

wait_for('message') returns a Message object, you need to append its content via .content

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)