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. */
|
||||
export function calculateMaxShards(maxShards: number, maxConcurrency: number): number {
|
||||
if (maxShards < 100) return maxShards;
|
||||
|
||||
|
||||
return Math.ceil(
|
||||
maxShards /
|
||||
(maxConcurrency === 1 ? 16 : maxConcurrency),
|
||||
|
||||
@@ -27,4 +27,4 @@ export interface ModifyWebhook {
|
||||
channelId?: bigint;
|
||||
/** The reason you are modifying this webhook */
|
||||
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 { addCacheCollections, BotWithCache } from "./src/addCacheCollections.ts";
|
||||
import { setupCacheEdits } from "./src/setupCacheEdits.ts";
|
||||
|
||||
+1
-10
@@ -1,13 +1,4 @@
|
||||
import {
|
||||
Bot,
|
||||
Collection,
|
||||
Channel,
|
||||
Guild,
|
||||
Member,
|
||||
Message,
|
||||
PresenceUpdate,
|
||||
User,
|
||||
} from "../deps.ts";
|
||||
import { Bot, Channel, Collection, Guild, Member, Message, PresenceUpdate, User } from "../deps.ts";
|
||||
|
||||
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";
|
||||
|
||||
export function setupCacheEdits<B extends Bot>(bot: BotWithCache<B>) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import {
|
||||
ApplicationCommandOptionChoice,
|
||||
Bot,
|
||||
Channel,
|
||||
Collection,
|
||||
CreateMessage,
|
||||
Channel,
|
||||
Member,
|
||||
Message,
|
||||
FinalHelpers,
|
||||
ListGuildMembers,
|
||||
Member,
|
||||
Message,
|
||||
} from "./deps.ts";
|
||||
import { cloneChannel } from "./src/channels.ts";
|
||||
import { sendAutocompleteChoices } from "./src/sendAutoCompleteChoices.ts";
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import type { Bot, DiscordenoInteractionResponse, DiscordenoMessage } from "../deps.ts";
|
||||
|
||||
/** 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
|
||||
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. */
|
||||
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), {
|
||||
name: options.name,
|
||||
archived: options.archived,
|
||||
auto_archive_duration: options.autoArchiveDuration,
|
||||
locked: options.locked,
|
||||
rate_limit_per_user: options.rateLimitPerUser,
|
||||
reason,
|
||||
});
|
||||
const result = await bot.rest.runMethod<DiscordChannel>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
bot.constants.endpoints.CHANNEL_BASE(threadId),
|
||||
{
|
||||
name: options.name,
|
||||
archived: options.archived,
|
||||
auto_archive_duration: options.autoArchiveDuration,
|
||||
locked: options.locked,
|
||||
rate_limit_per_user: options.rateLimitPerUser,
|
||||
reason,
|
||||
},
|
||||
);
|
||||
|
||||
return bot.transformers.channel(bot, {
|
||||
channel: result,
|
||||
|
||||
@@ -155,11 +155,13 @@ function makeEmojiFromString(
|
||||
) {
|
||||
if (!emoji) return;
|
||||
|
||||
if (typeof emoji !== "string") return {
|
||||
id: emoji.id ? BigInt(emoji.id) : undefined,
|
||||
name: emoji.name,
|
||||
animated: emoji.animated,
|
||||
};
|
||||
if (typeof emoji !== "string") {
|
||||
return {
|
||||
id: emoji.id ? BigInt(emoji.id) : undefined,
|
||||
name: emoji.name,
|
||||
animated: emoji.animated,
|
||||
};
|
||||
}
|
||||
|
||||
// A snowflake id was provided
|
||||
if (/^[0-9]+$/.test(emoji)) {
|
||||
|
||||
@@ -25,15 +25,15 @@ However, you probably want to use something shorter, such as the following:
|
||||
|
||||
```js
|
||||
class Channel {
|
||||
constructor(client, data) {
|
||||
this.client = client;
|
||||
this.id = data.id;
|
||||
this.name = data.name;
|
||||
}
|
||||
constructor(client, data) {
|
||||
this.client = client;
|
||||
this.id = data.id;
|
||||
this.name = data.name;
|
||||
}
|
||||
|
||||
async send(options) {
|
||||
return await client.helpers.sendMessage(this.id, options);
|
||||
}
|
||||
async send(options) {
|
||||
return await client.helpers.sendMessage(this.id, options);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user