Repository: python-discord/bot

Issue:
Remove Python formatting from !eval result codeblock
Currently when calling the !eval command the bot formats the result from the command as a python formatted codeblock. This can lead to a badly coloured result if the result is not python code (which it rarely would be). 

For example, if the result had an apostrophe:

![image](https://user-images.githubusercontent.com/22353562/80588666-aa549080-8a10-11ea-9cce-5831de762dcd.png)

The proposed solution would just to make it return a code block without python formatting. 
Here is the relevant line:
https://github.com/python-discord/bot/blob/fe325adc66e9621ea970abd83db58df4b792caa5/bot/cogs/snekbox.py#L204

(If this gets the go ahead I would be happy to do this but it's such a small fix I wouldn't mind if somebody else just did it. This is my first GitHub Issue and I'm learning as I go along so excuse me If I don't properly understand how things work straight away.)







Discussion:
The `.txt` suffix could also be added to the output url from when the code gets uploaded to [https://paste.pythondiscord.com](https://paste.pythondiscord.com), it has its own engine for guessing what format the contents are but for simple text it'll mostly detect a few keywords and then highlight it semi randomly with for example SQL syntax highlight
On the right of this issue, you can assign yourself if you'd like to work on it @wookie184. Numerlor's suggestion is also a good idea if you want to throw it in.
I've included my suggestion in https://github.com/python-discord/bot/pull/927/commits/077a1ef1eb4eb07325dde5b6b625a84ccb5669ee when moving the upload logic, the PR should be ready to go after an another review so you can skip that if you'd like

Resolving patch:
diff --git a/bot/cogs/snekbox.py b/bot/cogs/snekbox.py
--- a/bot/cogs/snekbox.py
+++ b/bot/cogs/snekbox.py
@@ -202,7 +202,7 @@ async def send_eval(self, ctx: Context, code: str) -> Message:
                 output, paste_link = await self.format_output(results["stdout"])
 
             icon = self.get_status_emoji(results)
-            msg = f"{ctx.author.mention} {icon} {msg}.\n\n```py\n{output}\n```"
+            msg = f"{ctx.author.mention} {icon} {msg}.\n\n```\n{output}\n```"
             if paste_link:
                 msg = f"{msg}\nFull output: {paste_link}"
 


Test patch:
diff --git a/tests/bot/cogs/test_snekbox.py b/tests/bot/cogs/test_snekbox.py
--- a/tests/bot/cogs/test_snekbox.py
+++ b/tests/bot/cogs/test_snekbox.py
@@ -239,7 +239,7 @@ async def test_send_eval(self):
 
         await self.cog.send_eval(ctx, 'MyAwesomeCode')
         ctx.send.assert_called_once_with(
-            '@LemonLemonishBeard#0042 :yay!: Return code 0.\n\n```py\n[No output]\n```'
+            '@LemonLemonishBeard#0042 :yay!: Return code 0.\n\n```\n[No output]\n```'
         )
         self.cog.post_eval.assert_called_once_with('MyAwesomeCode')
         self.cog.get_status_emoji.assert_called_once_with({'stdout': '', 'returncode': 0})
@@ -265,7 +265,7 @@ async def test_send_eval_with_paste_link(self):
         await self.cog.send_eval(ctx, 'MyAwesomeCode')
         ctx.send.assert_called_once_with(
             '@LemonLemonishBeard#0042 :yay!: Return code 0.'
-            '\n\n```py\nWay too long beard\n```\nFull output: lookatmybeard.com'
+            '\n\n```\nWay too long beard\n```\nFull output: lookatmybeard.com'
         )
         self.cog.post_eval.assert_called_once_with('MyAwesomeCode')
         self.cog.get_status_emoji.assert_called_once_with({'stdout': 'Way too long beard', 'returncode': 0})
@@ -289,7 +289,7 @@ async def test_send_eval_with_non_zero_eval(self):
 
         await self.cog.send_eval(ctx, 'MyAwesomeCode')
         ctx.send.assert_called_once_with(
-            '@LemonLemonishBeard#0042 :nope!: Return code 127.\n\n```py\nBeard got stuck in the eval\n```'
+            '@LemonLemonishBeard#0042 :nope!: Return code 127.\n\n```\nBeard got stuck in the eval\n```'
         )
         self.cog.post_eval.assert_called_once_with('MyAwesomeCode')
         self.cog.get_status_emoji.assert_called_once_with({'stdout': 'ERROR', 'returncode': 127})