Assigning Roles with Buttons - Python Discord Bot Tutorial

Published: 03 September 2021
on channel: Jonah Lawrence • Dev Pro Tips
21,568
240

How to add button components for role assignments to your Python Discord bot with Nextcord.

❤ Subscribe: http://bit.ly/SubscribeDPT

In this video, I will be using the Nextcord fork of Discord.py to make button components that correspond to roles that will be assigned to the user when they click them. This is similar to the old way of doing reaction roles, but this time, we can use real buttons!

The buttons used in this video are persistent, meaning they do not timeout and will continue working even if the bot restarts.

❗Note: The on_ready event listener may run multiple times. At 8:00 in the video, you can modify the function to avoid adding the view multiple times by checking if it has already been added using a variable on the bot. (See https://github.com/nextcord/nextcord/... for an example)

👨‍💻 Source Code
https://github.com/DenverCoder1/dev-p...

💬 Dev Pro Tips Discussion & Support Server
  / discord  

📜 Nextcord Documentation
https://nextcord.readthedocs.io/en/la...

🗨 Nextcord Server
  / discord  

📓 Python Discord Bot Template
https://github.com/DenverCoder1/disco...

📺 In this video:
0:00​ - Introduction
0:35 - Nextcord examples
0:58 - Setting up Buttons
10:28 - Assigning roles
13:51 - Conclusion

In future videos in this series, I plan to show you how you can:
Implement selects, and other Discord components
Implement slash commands
Welcome users
Interact with other APIs to make useful bot features
Much more

Make sure to subscribe so you don't miss anything!

🐍 More Discord Bot Tutorials
   • Building Discord Bots with Python 🐍  

💻 More tutorials
   • Tutorials  

🙋‍♂️ Find me on other channels
Discord 🗨️ https://bit.ly/dpt-discord
Twitter ✍   / denvercoder1  
Github 👨‍💻 https://github.com/DenverCoder1
Sponsor 💞 https://github.com/sponsors/DenverCoder1
Buy me a coffee ☕ https://ko-fi.com/jlawrence

💖 SPONSORS 💖
Get your username or a link to your channel here by sponsoring on GitHub
▶ https://github.com/sponsors/DenverCod...

🎁 GET FREE STUFF WHILE SUPPORTING MY TUTORIALS
► https://bit.ly/jlawrencepromos


On this page of the site you can watch the video online Assigning Roles with Buttons - Python Discord Bot Tutorial with a duration of hours minute second in good quality, which was uploaded by the user Jonah Lawrence • Dev Pro Tips 03 September 2021, share the link with friends and acquaintances, this video has already been watched 21,568 times on youtube and it was liked by 240 viewers. Enjoy your viewing!