forthebadge made-with-python



A discord bot to check if messages have the correct code formatting.

This was a basic project to help me learn Python and learn a little bit about API’s and hosting workers on heroku.

What it does is listens for messages with code inside, that are not formatted properly.

For example, if someone copy and pastes code into a guild for help with using code blocks or syntax highlighting.

If the bot detects code in the message, it will return the message back in the same channel properly highlighted and formatted based on guesslang’s best guess.
guesslang is not a perfect library in terms of guessing languages, but it works for this purpose. Besides, we don’t want the bot triggering for smaller messages anyway.

The !!help call tells users how they can format code and syntax highlight it themselves. It also lists the available markdown highlighting on discord.

You can invite this bot to your server using this link

Thanks for viewing!

This project was built using py-cord, a wrapper. See more information here

This project also uses a library called guesslang, a library to identify code languages from strings. See more here


View Github