Current section
Files
Jump to
Current section
Files
src/discord_gleam@discord@intents.erl
-module(discord_gleam@discord@intents).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/discord_gleam/discord/intents.gleam").
-export([intents_to_bitfield/1, default/0, default_with_message_intents/0, all/0, none/0]).
-export_type([intents/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-type intents() :: {intents,
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean(),
boolean()}.
-file("src/discord_gleam/discord/intents.gleam", 31).
-spec add_intent_bit(integer(), boolean(), integer()) -> integer().
add_intent_bit(Bitfield, Intent_enabled, Bit_position) ->
case Intent_enabled of
false ->
Bitfield;
true ->
erlang:'bor'(Bitfield, erlang:'bsl'(1, Bit_position))
end.
-file("src/discord_gleam/discord/intents.gleam", 43).
?DOC(" Calculate a bitfield from a set of intents.\n").
-spec intents_to_bitfield(intents()) -> integer().
intents_to_bitfield(Intents) ->
_pipe = 0,
_pipe@1 = add_intent_bit(_pipe, erlang:element(2, Intents), 0),
_pipe@2 = add_intent_bit(_pipe@1, erlang:element(3, Intents), 1),
_pipe@3 = add_intent_bit(_pipe@2, erlang:element(4, Intents), 2),
_pipe@4 = add_intent_bit(_pipe@3, erlang:element(5, Intents), 3),
_pipe@5 = add_intent_bit(_pipe@4, erlang:element(6, Intents), 4),
_pipe@6 = add_intent_bit(_pipe@5, erlang:element(7, Intents), 5),
_pipe@7 = add_intent_bit(_pipe@6, erlang:element(8, Intents), 6),
_pipe@8 = add_intent_bit(_pipe@7, erlang:element(9, Intents), 7),
_pipe@9 = add_intent_bit(_pipe@8, erlang:element(10, Intents), 8),
_pipe@10 = add_intent_bit(_pipe@9, erlang:element(11, Intents), 9),
_pipe@11 = add_intent_bit(_pipe@10, erlang:element(12, Intents), 10),
_pipe@12 = add_intent_bit(_pipe@11, erlang:element(13, Intents), 11),
_pipe@13 = add_intent_bit(_pipe@12, erlang:element(14, Intents), 12),
_pipe@14 = add_intent_bit(_pipe@13, erlang:element(15, Intents), 13),
_pipe@15 = add_intent_bit(_pipe@14, erlang:element(16, Intents), 14),
_pipe@16 = add_intent_bit(_pipe@15, erlang:element(17, Intents), 15),
_pipe@17 = add_intent_bit(_pipe@16, erlang:element(18, Intents), 16),
_pipe@18 = add_intent_bit(_pipe@17, erlang:element(19, Intents), 20),
_pipe@19 = add_intent_bit(_pipe@18, erlang:element(20, Intents), 21),
_pipe@20 = add_intent_bit(_pipe@19, erlang:element(21, Intents), 24),
add_intent_bit(_pipe@20, erlang:element(22, Intents), 25).
-file("src/discord_gleam/discord/intents.gleam", 70).
?DOC(
" Enable a set of default intents, which are usually used by most bots. \\\n"
" Does not include `message_content` intent, as its a privileged intent\n"
).
-spec default() -> intents().
default() ->
{intents,
true,
false,
false,
false,
false,
false,
false,
false,
false,
true,
true,
false,
true,
true,
false,
true,
false,
false,
false,
false,
false}.
-file("src/discord_gleam/discord/intents.gleam", 98).
?DOC(
" Enable a set of default intents, which are usually used by most bots. \\\n"
" But also includes all intents relevant to messages\n"
).
-spec default_with_message_intents() -> intents().
default_with_message_intents() ->
{intents,
true,
false,
false,
false,
false,
false,
false,
false,
false,
true,
true,
true,
true,
true,
true,
true,
false,
false,
false,
true,
true}.
-file("src/discord_gleam/discord/intents.gleam", 125).
?DOC(" Enable all the intents, use this if you want to receive all supported events.\n").
-spec all() -> intents().
all() ->
{intents,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true}.
-file("src/discord_gleam/discord/intents.gleam", 153).
?DOC(
" Disable all the intents, use this if you want to receive no events other than `interaction_create or ready. \\ \n"
" Useful if you have a bot with slash commands only, that dosen't need to listen to events.\n"
).
-spec none() -> intents().
none() ->
{intents,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false,
false}.