PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 11, 2022

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

 July 11, 2022     bots, discord, message, python     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

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

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing