Tutorial | Python | Discord.py

Upgrade your bot’s messages and make them a little more custom using embeds!

Title card by the author

When your Discord bot responds to your server, you don’t always want a boring default message to be sent back. Maybe you have links or images that you want to send back in chat. With Python and Discord.py, this is super easy to do in your Discord bot!

Note: This is tested on version 1.4.1 of the Discord.py module. You will encounter issues if you are using a version lower than 1.0. It is recommended that you migrate your code to a more current version.

Building Embeds

Embeds in Discord are simple and have a very clean, formatted look to them. In…


Tutorial | Python | dotenv

Hide your passwords and API tokens to make your code more secure

A cat hiding, just like your credentials should
A cat hiding, just like your credentials should
A cat hiding, just like your credentials should be! | Photo by Thomas Bormans on Unsplash

In a previous post, I left a Discord token in the script. This is not the ideal way to code, especially if I don’t want to regenerate my tokens every time I share code. Using credentials and API tokens in your data science and programming projects is inevitable, but leaving them exposed is avoidable. Using the dotenv python module can help keep these sensitive bits of information safe from prying eyes.

In a previous post I went through the steps to create a Discord bot using Discord.py in python. …


There are a ton of benefits to workers moving out of the office beyond the ease of accepting deliveries or having work done at home. When you start to throw a lot of different types of people together in places like coworking spaces, you can pick the brains of people outside your company who have very different experiences and perspectives on thing. It makes it much easier to get a different view because that person doesn't view your problems the same way or with the same background.

I touched on it in my post about getting more done by doing…


Tutorial | R | Shiny/API

Using R to put Senator Sanders in front of you house!

Bernie, waiting for you to write some code! (Image composited by the author)

Intro

Anyone who has been on the internet recently knows Bernie Sander’s iconic coat and mittens from the 2021 Presidential Inauguration. We’ve seen him popping up on college campuses and even billboards in the short time since it happened, but a particular project rises above the rest. A developer used Google Street view to put Bernie in front of any address you input.

Looking at the app, I thought it would be a fun project to reverse engineer and build it up a bit differently. The inspiration for this post can be seen here. …


A collection of people, real and fictional, who can teach us about life

Photo by Randy Tarampi on Unsplash

During tough times, it is important to find inspiration wherever you can. We can all agree that 2020 has been an especially tough year, whether it was from graduating but being unable to find a job, losing a job due to side effects of the global pandemic, getting sick, or knowing someone who was affected by one of these situations. As one of the worst years most of us can remember, where can we find inspiration to be better?

Well, inspiration is anywhere you look for it. It doesn’t have to come from real people, it doesn’t have to come…


Not working can have a positive impact on your work

Photo by Tim Gouw on Unsplash

Being stuck at home for the better part of a year has taken its toll. Normally we can escape the physical confines of work by going home. With many of us conducting business from our homes, that just isn’t the case anymore. This, combined with having trouble getting your code to run or not finding anything significant in your analysis can be draining.

You start to feel bad about not accomplishing anything. You start to doubt your skills and whether you are really getting anything done. It would be so easy to just sit back down and keep working at…


Strategies to boost you productivity, most of which involve less work!

Photo by Sid Leigh on Unsplash

My first job ever was in fast food, and it taught me a lot of things. There was a certain mentality that could be summed up by the phrase, “if you’re leaning you could be cleaning.” In a nutshell, there wasn’t meant to be any downtime. If there were no customers, there was always an unlimited supply of more work to do.

This constant nose to the grindstone philosophy really grinds away at your will to work. The ask is that you give your all for the company and work as hard as you possibly can constantly until it is…


Tutorial | Python | Discord.py

How to add rich formatting to Python Discord bots

Image by the author

Looking for that extra flair for your Discord bot responses? Making fonts bold, italic, strikethrough, and other options will give you more control over how responses look. You can draw attention to certain parts of messages, hide other parts, and generally improve the look and feel of your bot’s messages.

Previously we added some flair to our messages by using embeds to organize information sent by the bot. Now we will use the Discord markdown options to spice things up. You may have already used this to format text in the Discord app. You can see some of the options…


Bad news for anyone graduating this December looking for a job in Data Science. Unemployment is still nearly 2% higher than it was in 2019. So many people are still…


Tutorial | Python | Discord.py

Adding a Discord bot to a server doesn’t require any code!

So you have a Discord bot written in Discord.py and you are ready to test it or add the finished bot to your server. Looking at the Discord.py GitHub page, none of the examples have any code that adds them to the server, so how do you do it? Don’t worry, it doesn’t take any code, and is super easy to do!

Don’t have a Discord.py bot written yet? Check out my tutorial to get started with a simple bot!

Create a Discord Application

Open up the Discord Developer Portal in your browser. …

Drew Seewald

Data Scientist, Mercedes-Benz Financial Services | Twitter @RealDrewData | LinkedIn: www.linkedin.com/in/atseewal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store