mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
fix: fmt
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/** Handler used to determine max number of shards to use based upon the max concurrency. */
|
/** Handler used to determine max number of shards to use based upon the max concurrency. */
|
||||||
export function calculateMaxShards(maxShards: number, maxConcurrency: number): number {
|
export function calculateMaxShards(maxShards: number, maxConcurrency: number): number {
|
||||||
if (maxShards < 100) return maxShards;
|
if (maxShards < 100) return maxShards;
|
||||||
|
|
||||||
return Math.ceil(
|
return Math.ceil(
|
||||||
maxShards /
|
maxShards /
|
||||||
(maxConcurrency === 1 ? 16 : maxConcurrency),
|
(maxConcurrency === 1 ? 16 : maxConcurrency),
|
||||||
|
|||||||
@@ -27,4 +27,4 @@ export interface ModifyWebhook {
|
|||||||
channelId?: bigint;
|
channelId?: bigint;
|
||||||
/** The reason you are modifying this webhook */
|
/** The reason you are modifying this webhook */
|
||||||
reason?: string;
|
reason?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { Bot, Collection, DiscordGuildEmojisUpdate, } from "./deps.ts";
|
import { Bot, Collection, DiscordGuildEmojisUpdate } from "./deps.ts";
|
||||||
import { setupCacheRemovals } from "./src/setupCacheRemovals.ts";
|
import { setupCacheRemovals } from "./src/setupCacheRemovals.ts";
|
||||||
import { addCacheCollections, BotWithCache } from "./src/addCacheCollections.ts";
|
import { addCacheCollections, BotWithCache } from "./src/addCacheCollections.ts";
|
||||||
import { setupCacheEdits } from "./src/setupCacheEdits.ts";
|
import { setupCacheEdits } from "./src/setupCacheEdits.ts";
|
||||||
|
|||||||
+1
-10
@@ -1,13 +1,4 @@
|
|||||||
import {
|
import { Bot, Channel, Collection, Guild, Member, Message, PresenceUpdate, User } from "../deps.ts";
|
||||||
Bot,
|
|
||||||
Collection,
|
|
||||||
Channel,
|
|
||||||
Guild,
|
|
||||||
Member,
|
|
||||||
Message,
|
|
||||||
PresenceUpdate,
|
|
||||||
User,
|
|
||||||
} from "../deps.ts";
|
|
||||||
|
|
||||||
export type BotWithCache<B extends Bot = Bot> = B & CacheProps;
|
export type BotWithCache<B extends Bot = Bot> = B & CacheProps;
|
||||||
|
|
||||||
|
|||||||
Vendored
+8
-1
@@ -1,4 +1,11 @@
|
|||||||
import type { Bot, DiscordGuildMemberAdd, DiscordGuildMemberRemove, DiscordMessageReactionAdd, DiscordMessageReactionRemove, DiscordMessageReactionRemoveAll } from "../deps.ts";
|
import type {
|
||||||
|
Bot,
|
||||||
|
DiscordGuildMemberAdd,
|
||||||
|
DiscordGuildMemberRemove,
|
||||||
|
DiscordMessageReactionAdd,
|
||||||
|
DiscordMessageReactionRemove,
|
||||||
|
DiscordMessageReactionRemoveAll,
|
||||||
|
} from "../deps.ts";
|
||||||
import type { BotWithCache } from "./addCacheCollections.ts";
|
import type { BotWithCache } from "./addCacheCollections.ts";
|
||||||
|
|
||||||
export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import {
|
import {
|
||||||
ApplicationCommandOptionChoice,
|
ApplicationCommandOptionChoice,
|
||||||
Bot,
|
Bot,
|
||||||
|
Channel,
|
||||||
Collection,
|
Collection,
|
||||||
CreateMessage,
|
CreateMessage,
|
||||||
Channel,
|
|
||||||
Member,
|
|
||||||
Message,
|
|
||||||
FinalHelpers,
|
FinalHelpers,
|
||||||
ListGuildMembers,
|
ListGuildMembers,
|
||||||
|
Member,
|
||||||
|
Message,
|
||||||
} from "./deps.ts";
|
} from "./deps.ts";
|
||||||
import { cloneChannel } from "./src/channels.ts";
|
import { cloneChannel } from "./src/channels.ts";
|
||||||
import { sendAutocompleteChoices } from "./src/sendAutoCompleteChoices.ts";
|
import { sendAutocompleteChoices } from "./src/sendAutoCompleteChoices.ts";
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
import type { Bot, DiscordenoInteractionResponse, DiscordenoMessage } from "../deps.ts";
|
import type { Bot, DiscordenoInteractionResponse, DiscordenoMessage } from "../deps.ts";
|
||||||
|
|
||||||
/** sendInteractionResponse with ephemeral reply */
|
/** sendInteractionResponse with ephemeral reply */
|
||||||
export function sendPrivateInteractionResponse(bot: Bot, id: bigint, token: string, options: DiscordenoInteractionResponse): Promise<DiscordenoMessage | undefined> {
|
export function sendPrivateInteractionResponse(
|
||||||
|
bot: Bot,
|
||||||
|
id: bigint,
|
||||||
|
token: string,
|
||||||
|
options: DiscordenoInteractionResponse,
|
||||||
|
): Promise<DiscordenoMessage | undefined> {
|
||||||
if (options.data && !options.data?.flags) options.data.flags = 64; // private: true
|
if (options.data && !options.data?.flags) options.data.flags = 64; // private: true
|
||||||
return bot.helpers.sendInteractionResponse(id, token, options);
|
return bot.helpers.sendInteractionResponse(id, token, options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,14 +22,19 @@ export async function unlockThread(bot: Bot, threadId: bigint) {
|
|||||||
|
|
||||||
/** Update a thread's settings. Requires the `MANAGE_CHANNELS` permission for the guild. */
|
/** Update a thread's settings. Requires the `MANAGE_CHANNELS` permission for the guild. */
|
||||||
export async function editThread(bot: Bot, threadId: bigint, options: ModifyThread, reason?: string) {
|
export async function editThread(bot: Bot, threadId: bigint, options: ModifyThread, reason?: string) {
|
||||||
const result = await bot.rest.runMethod<DiscordChannel>(bot.rest, "patch", bot.constants.endpoints.CHANNEL_BASE(threadId), {
|
const result = await bot.rest.runMethod<DiscordChannel>(
|
||||||
name: options.name,
|
bot.rest,
|
||||||
archived: options.archived,
|
"patch",
|
||||||
auto_archive_duration: options.autoArchiveDuration,
|
bot.constants.endpoints.CHANNEL_BASE(threadId),
|
||||||
locked: options.locked,
|
{
|
||||||
rate_limit_per_user: options.rateLimitPerUser,
|
name: options.name,
|
||||||
reason,
|
archived: options.archived,
|
||||||
});
|
auto_archive_duration: options.autoArchiveDuration,
|
||||||
|
locked: options.locked,
|
||||||
|
rate_limit_per_user: options.rateLimitPerUser,
|
||||||
|
reason,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return bot.transformers.channel(bot, {
|
return bot.transformers.channel(bot, {
|
||||||
channel: result,
|
channel: result,
|
||||||
|
|||||||
@@ -155,11 +155,13 @@ function makeEmojiFromString(
|
|||||||
) {
|
) {
|
||||||
if (!emoji) return;
|
if (!emoji) return;
|
||||||
|
|
||||||
if (typeof emoji !== "string") return {
|
if (typeof emoji !== "string") {
|
||||||
id: emoji.id ? BigInt(emoji.id) : undefined,
|
return {
|
||||||
name: emoji.name,
|
id: emoji.id ? BigInt(emoji.id) : undefined,
|
||||||
animated: emoji.animated,
|
name: emoji.name,
|
||||||
};
|
animated: emoji.animated,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// A snowflake id was provided
|
// A snowflake id was provided
|
||||||
if (/^[0-9]+$/.test(emoji)) {
|
if (/^[0-9]+$/.test(emoji)) {
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ However, you probably want to use something shorter, such as the following:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
class Channel {
|
class Channel {
|
||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
this.name = data.name;
|
this.name = data.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
async send(options) {
|
async send(options) {
|
||||||
return await client.helpers.sendMessage(this.id, options);
|
return await client.helpers.sendMessage(this.id, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user