Skip to content
Advertisement

How do I merge values into one message in discord.py

I want my bot to be able to say a message, mention a user, then respond with a random message, all in the same line, as opposed to having it in 3 separate lines.

This was my previous method:

JavaScript

However, this makes them all appear in the same line, but I can’t figure out how to merge them into a singular line. This was one of my many failed attempts:

JavaScript

(please don’t make fun of my amateur coding skills lmao)

Advertisement

Answer

assuming you are using python3+, you could do f-strings

JavaScript

there are other alternatives to this, such as format strings

JavaScript

concatenation methods like

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement