From b866d7c9727d35695eaff2f5ef4e9d25b1b25474 Mon Sep 17 00:00:00 2001 From: DroidDevelopment Date: Sun, 3 Nov 2024 20:55:49 -0500 Subject: [PATCH 1/2] Add support for defining a custom bitwise value when settings intents. --- lib/discordrb/bot.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/discordrb/bot.rb b/lib/discordrb/bot.rb index 9fb43b91d..4b0cda0b9 100644 --- a/lib/discordrb/bot.rb +++ b/lib/discordrb/bot.rb @@ -1712,6 +1712,8 @@ def handle_awaits(event) end def calculate_intents(intents) + intents = [intents] unless intents.is_a? Array + intents.reduce(0) do |sum, intent| case intent when Symbol From 7a5294d01a8be70ad0c56ec3c06c5095d91d14f6 Mon Sep 17 00:00:00 2001 From: DroidDevelopment Date: Sun, 3 Nov 2024 20:59:08 -0500 Subject: [PATCH 2/2] Update documentation. --- lib/discordrb/bot.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/discordrb/bot.rb b/lib/discordrb/bot.rb index 4b0cda0b9..a186fa8c3 100644 --- a/lib/discordrb/bot.rb +++ b/lib/discordrb/bot.rb @@ -106,9 +106,10 @@ class Bot # to Discord's gateway. `:none` will request that no payloads are received compressed (not recommended for # production bots). `:large` will request that large payloads are received compressed. `:stream` will request # that all data be received in a continuous compressed stream. - # @param intents [:all, :unprivileged, Array, :none] Gateway intents that this bot requires. `:all` will + # @param intents [:all, :unprivileged, Array, :none, Integer] Gateway intents that this bot requires. `:all` will # request all intents. `:unprivileged` will request only intents that are not defined as "Privileged". `:none` - # will request no intents. An array of symbols will request only those intents specified. + # will request no intents. An array of symbols will request only those intents specified. An integer value will request + # exactly all the intents specified in the bitwise value. # @see Discordrb::INTENTS def initialize( log_mode: :normal,