Monday, July 11, 2022

[FIXED] How do you make a bot go a line down in a message?

Issue

For some time, I've been working on a discord bot using python. Everything is going great, but there is one problem I haven't found a solution to. In the discord app itself, when typing in a chat, you can hold down the "shift" button and press "enter" to go a line down in chat. How do you make the bot do that in a text? Here is an example of what I'm currently doing

      if message.content.startswith('$help'):
    await message.channel.send('Hello. What can I help you with?')

There is probably an easy answer since I know it's possible. But I haven't found it.


Solution

You can add a newline with the \n escape character.

  if message.content.startswith('$help'):
    await message.channel.send('Hello.\nWhat can I help you with?')

This would print

Hello. 
What can I help you with?


Answered By - isopach
Answer Checked By - Terry (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.