• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
  • YouTube
  • MakerWorld
  • Instagram
  • Threads
  • Bluesky
  • Mastodon
  • Facebook
makerhacks-logo

Maker Hacks

Ideas, news & tutorials for makers and hackers – Arduino/Raspberry Pi, 3D printing, robotics, laser cutting, and more

  • Home
  • About
  • 3D Printing
  • Laser Cutting
  • CNC
  • Programming
  • Free Arduino Course
  • Free Robotics Course
  • Recommendations

Linux Automation Tip: Listen for Commands with your Discord Bot using Python

You are here: Home / Software and Programming / Linux Automation Tip: Listen for Commands with your Discord Bot using Python
Author: Chris Garrett

A Discord bot that only SENDS messages is all well and good, but really we want our bots to interact. We need to make them listen and respond.

Python Discord Bot
Python Discord Bot

A Discord bot that only SENDS messages is all well and good, but really we want our bots to interact. We need to make them listen and respond. Let’s do that now.

Previously:

Linux Automation Tip: Send Messages to Your Discord Server Using Python

Event Driven Computing

If you have done any visual or object-oriented programming you will be aware of what is called listening for or raising an “event”.

Essentially your program keeps quietly processing until something happens, then it jumps into action.

So with this in mind, we need to tell our bot what to look for and how to respond!

Code

You will need the Discord code library before you can run any of these commands so grab it like so:

python3 -m pip install discord

(Copy and paste the code from this Gist here)

Discord Bot Python Code
Discord Bot Python Code

Running the Bot

First, you need to create your bott app, and associate a new bot with it:

Discord - Developer Site
Set up your App at the Discord Developer Site

Discord - Developer Documentation-1

Then you need to go to the permissions URL to authorize your bot to do its thing:

https://discordapp.com/oauth2/authorize?&client_id=YOUR_CLIENT_ID&scope=bot&permissions=0

Authorize access to your account
Authorize access to your account

When your script is running and the bot is authorized you should get notified in your server thusly:

Category: Software and ProgrammingTag: linux, making, python, technology

About Chris Garrett

Marketing nerd by day, maker, retro gaming, tabletop war/roleplaying nerd by night. Co-author of the Problogger Book with Darren Rowse. Husband, Dad, 🇨🇦 Canadian.

Check out Retro Game Coders for retro gaming/computing.

☕️ Support Chris on Ko-Fi to get exclusive content and rewards!

Previous Post:Creality CR-10 MINICreality CR-10 MINI Review
Next Post:Linux Automation Tip: Process Discord Messages and Launch Shell Commands in Python

Sidebar

  • Facebook
  • Instagram
  • YouTube

Featured Posts

  • CyberBrick Review + Getting Started
  • xTool M2 Review
  • xTool F2 Ultra Review
  • xTool F2 Review
  • xTool S1 Review
  • Anycubic Kobra S1 Combo Review
  • Makera Z1 Pro Review
  • CNC Buyer's Guide
  • eufyMake E1 UV Printer Review
  • eufyMake Purifier P1
  • Z80 on a Breadboard
  • OpenSCAD MakerWorld Customizer

30 Days to Arduino

Arduino Tutorials
  • 3D Printing
  • CNC
  • Electronics and Hardware
  • Laser Cutting
  • News and Reviews
  • Software and Programming

arduino budget cad cnc diode laser glowforge Hacks Ideas laser cutter linux Makes making python raspberry pi Reviews technology tips xtool xTool Lasers

  • YouTube
  • MakerWorld
  • Instagram
  • Threads
  • Bluesky
  • Mastodon
  • Facebook

.

Maker Hacks Blog Copyright © 2026 · All Rights Reserved · Privacy Policy