mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
refactor: rename *ID to *Id (#710)
* refactor: rename *ID to *Id * Update src/helpers/commands/delete_slash_command.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/commands/delete_slash_command.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/commands/delete_slash_response.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/commands/edit_slash_response.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/utils.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/utils.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/utils.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/utils.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/utils.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/commands/get_slash_command.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/commands/send_interaction_response.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/commands/upsert_slash_command.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/guilds/edit_widget.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/guilds/get_widget.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/guilds/get_widget.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/guilds/get_widget_image_url.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/guilds/get_widget_image_url.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/guilds/get_widget_settings.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update .gitignore Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update LICENSE Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/members/edit_bot_profile.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/members/edit_bot_profile.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/webhooks/create_webhook.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/webhooks/delete_webhook.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/constants.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/webhooks/edit_webhook.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/webhooks/execute_webhook.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/webhooks/get_webhook.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/rest/cache.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/rest/request.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/constants.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/helpers/commands/delete_slash_response.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/constants.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/constants.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/constants.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/constants.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/utils.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Update src/util/utils.ts Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com> * Revert docs file Co-authored-by: ITOH <72305210+itohatweb@users.noreply.github.com>
This commit is contained in:
+19
-19
@@ -17,26 +17,26 @@ export function allowNextShard(enabled = true) {
|
||||
export async function spawnShards(
|
||||
data: DiscordBotGatewayData,
|
||||
payload: DiscordIdentify,
|
||||
shardID: number,
|
||||
lastShardID: number,
|
||||
shardId: number,
|
||||
lastShardId: number,
|
||||
skipChecks?: number,
|
||||
) {
|
||||
// All shards on this worker have started! Cancel out.
|
||||
if (shardID >= lastShardID) return;
|
||||
if (shardId >= lastShardId) return;
|
||||
|
||||
if (skipChecks) {
|
||||
payload.shard = [
|
||||
shardID,
|
||||
data.shards > lastShardID ? data.shards : lastShardID,
|
||||
shardId,
|
||||
data.shards > lastShardId ? data.shards : lastShardId,
|
||||
];
|
||||
// Start The shard
|
||||
createShard(data, payload, false, shardID);
|
||||
createShard(data, payload, false, shardId);
|
||||
// Spawn next shard
|
||||
await spawnShards(
|
||||
data,
|
||||
payload,
|
||||
shardID + 1,
|
||||
lastShardID,
|
||||
shardId + 1,
|
||||
lastShardId,
|
||||
skipChecks - 1,
|
||||
);
|
||||
return;
|
||||
@@ -49,23 +49,23 @@ export async function spawnShards(
|
||||
await spawnShards(
|
||||
data,
|
||||
payload,
|
||||
shardID,
|
||||
lastShardID,
|
||||
shardId,
|
||||
lastShardId,
|
||||
data.session_start_limit.max_concurrency,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
await delay(1000);
|
||||
await spawnShards(data, payload, shardID, lastShardID, skipChecks);
|
||||
await spawnShards(data, payload, shardId, lastShardId, skipChecks);
|
||||
}
|
||||
|
||||
export async function handleDiscordPayload(
|
||||
data: DiscordPayload,
|
||||
shardID: number,
|
||||
shardId: number,
|
||||
) {
|
||||
eventHandlers.raw?.(data);
|
||||
await eventHandlers.dispatchRequirements?.(data, shardID);
|
||||
await eventHandlers.dispatchRequirements?.(data, shardId);
|
||||
|
||||
switch (data.op) {
|
||||
case DiscordGatewayOpcodes.HeartbeatACK:
|
||||
@@ -74,26 +74,26 @@ export async function handleDiscordPayload(
|
||||
case DiscordGatewayOpcodes.Dispatch:
|
||||
if (!data.t) return;
|
||||
// Run the appropriate handler for this event.
|
||||
return handlers[data.t]?.(data, shardID);
|
||||
return handlers[data.t]?.(data, shardId);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
export async function requestAllMembers(
|
||||
guildID: string,
|
||||
shardID: number,
|
||||
guildId: string,
|
||||
shardId: number,
|
||||
resolve: (
|
||||
value: Collection<string, Member> | PromiseLike<Collection<string, Member>>,
|
||||
) => void,
|
||||
options?: FetchMembersOptions,
|
||||
) {
|
||||
const nonce = `${guildID}-${Date.now()}`;
|
||||
const nonce = `${guildId}-${Date.now()}`;
|
||||
cache.fetchAllMembersProcessingRequests.set(nonce, resolve);
|
||||
|
||||
await requestGuildMembers(
|
||||
guildID,
|
||||
shardID,
|
||||
guildId,
|
||||
shardId,
|
||||
nonce,
|
||||
options,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user