refactor(.github,README,gateway,plugins/fileloader,tests,types)!: make intent calculation manual

This changes the calculation of intents to be manual to the dev.
This is to improve overall consistency of our code base, also it is not a big drawback for users since intents are usually done once and then never (seldom) touched again.
This commit is contained in:
ITOH
2022-05-24 23:16:01 +02:00
parent 3a5263c4e9
commit d7883855ec
13 changed files with 35 additions and 37 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ startGateway({
/** Whether or not to use compression for gateway payloads. */
compress: true,
/** The intents you would like to enable. */
intents: ["GUILDS", "GUILD_MESSAGES"],
intents: Intents.Guilds | Intents.GuildMessages,
/** The max amount of shards used for identifying. This can be useful for zero-downtime updates or resharding. */
maxShards: 885,
/** The first shard Id for this group of shards. */
+2 -5
View File
@@ -59,10 +59,7 @@ export function createGatewayManager(
$os: options.$os ?? "linux",
$browser: options.$browser ?? "Discordeno",
$device: options.$device ?? "Discordeno",
intents:
(Array.isArray(options.intents)
? options.intents.reduce((bits, next) => (bits |= GatewayIntents[next]), 0)
: options.intents) ?? 0,
intents: options.intents ?? 0,
shard: options.shard ?? [0, options.shardsRecommended ?? 1],
presence: options.presence,
urlWSS: options.urlWSS ?? "wss://gateway.discord.gg/?v=9&encoding=json",
@@ -131,7 +128,7 @@ export interface GatewayManager {
$os: string;
$browser: string;
$device: string;
intents: number | (keyof typeof GatewayIntents)[];
intents: GatewayIntents;
shard: [number, number];
presence?: Omit<StatusUpdate, "afk" | "since">;