Format files

This commit is contained in:
ayntee
2021-04-13 06:05:20 +00:00
parent 405f362ec9
commit b633689d3a
9 changed files with 24 additions and 19 deletions

View File

@@ -8,14 +8,14 @@ import { camelKeysToSnakeCase } from "../../util/utils.ts";
export async function ban(
guildId: string,
id: string,
options: CreateGuildBan
options: CreateGuildBan,
) {
await requireBotGuildPermissions(guildId, ["BAN_MEMBERS"]);
const result = await rest.runMethod(
"put",
endpoints.GUILD_BAN(guildId, id),
camelKeysToSnakeCase(options)
camelKeysToSnakeCase(options),
);
return result;

View File

@@ -10,7 +10,10 @@ import {
requireBotChannelPermissions,
requireBotGuildPermissions,
} from "../../util/permissions.ts";
import { camelKeysToSnakeCase, snakeKeysToCamelCase } from "../../util/utils.ts";
import {
camelKeysToSnakeCase,
snakeKeysToCamelCase,
} from "../../util/utils.ts";
/** Edit the member */
export async function editMember(

View File

@@ -16,7 +16,7 @@ import { Collection } from "../../util/collection.ts";
export function fetchMembers(
guildId: string,
shardId: number,
options?: RequestGuildMembers
options?: RequestGuildMembers,
) {
// You can request 1 member without the intent
if (
@@ -41,9 +41,9 @@ function requestAllMembers(
resolve: (
value:
| Collection<string, DiscordenoMember>
| PromiseLike<Collection<string, DiscordenoMember>>
| PromiseLike<Collection<string, DiscordenoMember>>,
) => void,
options: any
options: any,
): void {
throw new Error("Function not implemented.");
}

View File

@@ -9,7 +9,7 @@ import { Collection } from "../../util/collection.ts";
export async function getMembersByQuery(
guildId: string,
name: string,
limit = 1
limit = 1,
) {
const guild = await cacheHandlers.get("guilds", guildId);
if (!guild) return;
@@ -28,9 +28,9 @@ function requestAllMembers(
resolve: (
value:
| Collection<string, DiscordenoMember>
| PromiseLike<Collection<string, DiscordenoMember>>
| PromiseLike<Collection<string, DiscordenoMember>>,
) => void,
arg3: { query: string; limit: number }
arg3: { query: string; limit: number },
): void {
throw new Error("Function not implemented.");
}

View File

@@ -13,7 +13,7 @@ import { requireBotChannelPermissions } from "../../util/permissions.ts";
/** Edit the message. */
export async function editMessage(
message: DiscordenoMessage,
content: string | EditMessage
content: string | EditMessage,
) {
if (message.author.id !== botId) {
throw "You can only edit a message that was sent by the bot.";
@@ -32,7 +32,7 @@ export async function editMessage(
const result: DiscordMessage = await rest.runMethod(
"patch",
endpoints.CHANNEL_MESSAGE(message.channelId, message.id),
content
content,
);
return structures.createDiscordenoMessage(result);

View File

@@ -2,7 +2,7 @@ import { rest } from "../../rest/rest.ts";
import { DiscordUser } from "../../types/users/user.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import {GetReactions} from "../../types/messages/message_get_reactions.ts";
import { GetReactions } from "../../types/messages/message_get_reactions.ts";
/** Get a list of users that reacted with this emoji. */
export async function getReactions(

View File

@@ -79,4 +79,3 @@ export async function executeWebhook(
return structures.createDiscordenoMessage(result as DiscordMessage);
}

View File

@@ -73,7 +73,7 @@ const baseMessage: Partial<DiscordenoMessage> = {
? {
content,
allowedMentions: {
repliedUser: true
repliedUser: true,
},
messageReference: {
messageId: this.id,
@@ -82,11 +82,13 @@ const baseMessage: Partial<DiscordenoMessage> = {
}
: {
...content,
allowedMentions: { ...(content.allowedMentions || {}), repliedUser: true },
allowedMentions: {
...(content.allowedMentions || {}),
repliedUser: true,
},
messageReference: {
messageId: this.id,
failIfNotExists:
content.messageReference?.failIfNotExists === true,
failIfNotExists: content.messageReference?.failIfNotExists === true,
},
};

View File

@@ -20,13 +20,14 @@ export async function resharder() {
// Begin resharding
ws.maxShards = ws.botGatewayData.shards;
// If more than 100K servers, begin switching to 16x sharding
if (ws.maxShards && ws.useOptimalLargeBotSharding)
if (ws.maxShards && ws.useOptimalLargeBotSharding) {
ws.maxShards = Math.ceil(
ws.maxShards /
(ws.botGatewayData.sessionStartLimit.maxConcurrency === 1
? 16
: ws.botGatewayData.sessionStartLimit.maxConcurrency)
: ws.botGatewayData.sessionStartLimit.maxConcurrency),
);
}
ws.spawnShards(ws.firstShardId);
}