From bb18023d3ba2f7808a2a16ea7f70cc3b39a43574 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Mon, 5 Oct 2020 14:11:27 +0200 Subject: Intents: initial setup For now, we require the privileged 'Guild Members' intent, to maintain all current functionality (e.g. Member convertors working with IDs). In the future, we may look into disabling this intent. --- bot/bot.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bot/bot.py') diff --git a/bot/bot.py b/bot/bot.py index ffaf4284..d95ac2d8 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -204,8 +204,18 @@ class SeasonalBot(commands.Bot): _allowed_roles = [discord.Object(id_) for id_ in MODERATION_ROLES] + +_intents = discord.Intents().all() +_intents.bans = False +_intents.integrations = False +_intents.invites = False +_intents.presences = False +_intents.typing = False +_intents.webhooks = False + bot = SeasonalBot( command_prefix=Client.prefix, activity=discord.Game(name=f"Commands: {Client.prefix}help"), allowed_mentions=discord.AllowedMentions(everyone=False, roles=_allowed_roles), + intents=_intents, ) -- cgit v1.2.3 From 253e69abc5b1941c78dab4a7afa96535a4d3f9a3 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Mon, 5 Oct 2020 14:44:57 +0200 Subject: Intents: call classmethod on class, not intermediate instance --- bot/bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bot/bot.py') diff --git a/bot/bot.py b/bot/bot.py index d95ac2d8..3870534e 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -205,7 +205,7 @@ class SeasonalBot(commands.Bot): _allowed_roles = [discord.Object(id_) for id_ in MODERATION_ROLES] -_intents = discord.Intents().all() +_intents = discord.Intents.all() _intents.bans = False _intents.integrations = False _intents.invites = False -- cgit v1.2.3 From 59a9811d600a6a0ede6c627ec7758918cb13a6e6 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Sat, 31 Oct 2020 12:41:06 +0100 Subject: Intents: disable privileged 'Members' intent With 'd.py' 1.5.1, the Member converter will now lazily fetch the member object. It is believed that this removes our need for the intent. --- bot/bot.py | 1 + 1 file changed, 1 insertion(+) (limited to 'bot/bot.py') diff --git a/bot/bot.py b/bot/bot.py index 3870534e..5a301858 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -209,6 +209,7 @@ _intents = discord.Intents.all() _intents.bans = False _intents.integrations = False _intents.invites = False +_intents.members = False _intents.presences = False _intents.typing = False _intents.webhooks = False -- cgit v1.2.3 From 937ac68f15f0cc0abf1983c3f8cfd46403dd4156 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Sat, 31 Oct 2020 12:42:50 +0100 Subject: Intents: document which intents are privileged --- bot/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bot/bot.py') diff --git a/bot/bot.py b/bot/bot.py index 5a301858..e762f0c4 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -209,8 +209,8 @@ _intents = discord.Intents.all() _intents.bans = False _intents.integrations = False _intents.invites = False -_intents.members = False -_intents.presences = False +_intents.members = False # Privileged +_intents.presences = False # Privileged _intents.typing = False _intents.webhooks = False -- cgit v1.2.3 From fa3b50e835ae63edd3a016d248a19f321ce0f86b Mon Sep 17 00:00:00 2001 From: kwzrd Date: Sat, 31 Oct 2020 13:08:15 +0100 Subject: Intents: use 'default' factory Since we disable both privileged intents, we can just construct an instance with them already off. As Senjan notes, this will also future-proof us against any privileged intents added in the future. Co-authored-by: Senjan21 <53477086+Senjan21@users.noreply.github.com> --- bot/bot.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'bot/bot.py') diff --git a/bot/bot.py b/bot/bot.py index e762f0c4..cef4c4d4 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -205,12 +205,10 @@ class SeasonalBot(commands.Bot): _allowed_roles = [discord.Object(id_) for id_ in MODERATION_ROLES] -_intents = discord.Intents.all() +_intents = discord.Intents.default() # Default is all intents except for privileged ones (Members, Presences, ...) _intents.bans = False _intents.integrations = False _intents.invites = False -_intents.members = False # Privileged -_intents.presences = False # Privileged _intents.typing = False _intents.webhooks = False -- cgit v1.2.3