Skip to content

Commit

Permalink
Add intents support for discord.py 1.5.0 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
eibex authored Oct 8, 2020
1 parent 1eec54b commit 391aed0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.1
2.0.0
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Reaction Light - Changelog
This project adheres to [semantic versioning](https://semver.org/).

### 2.0.0
- Added support for discord.py 1.5.0 and dropped support for any older version (the new Discord API is replacing the older one) ([[#47](https://github.com/eibex/reaction-light/issues/47) closed by [#48](https://github.com/eibex/reaction-light/pull/48) by [eibex](https://github.com/eibex))
- **What you NEED to do**
- Add the server members priviliged intent to your bot on the [Discord Developer Portal](https://discord.com/developers/applications)
- You might have to re-clone the bot because of git history conflicts (copy the `config.ini` file and the `files` folder to the new installation and all your reaction-role messages will keep working as expected)

### 1.6.1
- Prevent adding an already existing reaction to new or existing reaction-role messages.

Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Reaction Light - Discord Role Bot
[![Reaction Light 1.6.1](https://img.shields.io/badge/Reaction%20Light-1.6.1-yellow.svg)](https://github.com/eibex/reaction-light/blob/master/CHANGELOG.md)
[![Reaction Light 2.0.0](https://img.shields.io/badge/Reaction%20Light-2.0.0-yellow.svg)](https://github.com/eibex/reaction-light/blob/master/CHANGELOG.md)
[![Python 3.5.3+](https://img.shields.io/badge/python-3.5.3+-blue.svg)](#)
[![discord.py 1.3.4+](https://img.shields.io/badge/discord.py-1.3.4+-blue.svg)](#)
[![discord.py 1.5.0+](https://img.shields.io/badge/discord.py-1.5.0+-blue.svg)](#)

![Reaction Light Embed Example](https://i.imgur.com/f4b9Qye.png)

Expand Down Expand Up @@ -34,7 +34,7 @@ You can host the bot yourself by configuring the `config.ini` file (manually or
- [License](#license)

## Requirements
This bot requires discord.py 1.3.4+, which requires Python 3.5.3+.
This bot requires discord.py 1.5.0+, which requires Python 3.5.3+.

You can get discord.py (and other dependencies) via PyPI:
```
Expand All @@ -46,6 +46,7 @@ python3 -m pip install -U discord.py
- `git` comes pre-installed on most Linux-based operating systems. On Windows, if you are not familiar with git, you can use [GitHub Desktop](https://desktop.github.com/)
- Run `setup.py` and follow the instructions or create a `config.ini` file (example provided in `config.ini.sample`) and edit it manually:
- Insert the token of your bot (found at: https://discord.com/developers/applications/)
- Make sure you enabled the **server members intent** on your bot developer page
- Choose a prefix of your liking (default: `rl!`)
- Set a name to appear in embed footers (default: Reaction Light)
- URL of the footer logo (default: same as picture above)
Expand Down
14 changes: 11 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@
else None
)

Client = discord.Client()
bot = commands.Bot(command_prefix=prefix)
intents = discord.Intents.default()
intents.members = True
intents.reactions = True
intents.messages = True
intents.emojis = True
bot = commands.Bot(command_prefix=prefix, intents=intents)

bot.remove_command("help")

activities_file = f"{directory}/files/activities.csv"
Expand Down Expand Up @@ -1271,5 +1276,8 @@ async def update(ctx):
else:
await ctx.send("You do not have an admin role.")

try:
bot.run(TOKEN)

bot.run(TOKEN)
except discord.PrivilegedIntentsRequired:
print("You need to enable the server members intent on the Discord Developers Portal.")

0 comments on commit 391aed0

Please sign in to comment.