1

I'm having a problem with a say command, and it is that i can't send a well formated text.

I wanted to make it look like this: enter image description here

But it answers with this: enter image description here

Here is the code:

#COMMAND say
@commands.command()
@commands.has_any_role(*Say_Role)
async def say(self, ctx, *message):
    await ctx.message.delete()
    channel = ctx.channel
    await ctx.send(f"✅", delete_after=0.1)
    await channel.send(message)

What I need to do in order to make it look like the first image?

Zeninツ
  • 175
  • 1
  • 9
  • 1
    To get the message, I would just do something like: message_content_to_post = ctx.message.content.replace("!say ","") and then simply await ctx.send(message_content_to_post) – Infinity Jul 19 '22 at 15:08
  • @Infinity I got an error: `RuntimeWarning: Enable tracemalloc to get the object allocation traceback` – Zeninツ Jul 19 '22 at 15:21
  • 1
    Seems like you haven't used await somewhere and have instead written it as if calling a synchronous function – Infinity Jul 19 '22 at 15:25

1 Answers1

3

That's the wrong way to use the consume rest behavior.

Doing func(*args) will make args into a tuple of arguments, like ('this', 'is', 'an', 'argument'). See more here.

You're probably looking to make it a string:

async def say(self, ctx, *, message: str):
    ...
Eric Jin
  • 3,836
  • 4
  • 19
  • 45