Bot Interaction
Building Discord bots using the discord Python library is a simple affair. After importing the discord library into your Python script, you just need to instantiate a bot object and pass it the token that was generated during your bot’s application configuration. The discord Python library utilizes a cool Python feature called decorators[89] that acts like a function or class, wrapping another function or class and changing its behavior. Not only does this allow chaining of multiple functions and classes, but the decorator syntax keeps Python code from bloating with unnecessary complexity and verbosity.
For our Discord RedditBot, we need it to respond to three different inputs:
- !list
- !hide
- !clear
!list will call the subreddit submission ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access