Pasting codes in discord is easy as can be. Here are the two most common ways to do it:
Block Display Code – this method is best for when your code is very long and will run over more than one line.
First, type in three backticks, and then paste your code into Discord, pressing shift while doing it in order to indicate to Markdown that you want to begin a new line.
Side note: Discord may instantly recognize the code you have entered, meaning that it will automatically begin the new line, so pressing shift will only be necessary if Discord does not do this, and you need to manually create the new line.
Then, close the pasted code with three backticks.
Hit send, and your text will now display as the chosen code block you pasted.
Line Display Code – this method is best for shorter code, or if you want to use code in conversation, such as to share an example of single-line code.
Type into the textbox one backtick, and then paste your code.
End the code using just one backtick.
Hit send, and the message will show the pasted code.