mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
change: prettier code
This commit is contained in:
committed by
GitHub Action
parent
20616e8a36
commit
3a08aa15f4
@@ -15,7 +15,7 @@ export async function createGuild(bot: Bot, options: CreateGuild) {
|
||||
roles: options.roles,
|
||||
system_channel_flags: options.systemChannelFlags,
|
||||
system_channel_id: options.systemChannelId,
|
||||
verification_level: options.verificationLevel
|
||||
verification_level: options.verificationLevel,
|
||||
});
|
||||
|
||||
const guild = bot.transformers.guild(bot, { guild: result, shardId: 0 });
|
||||
|
||||
@@ -18,16 +18,12 @@ export async function editGuild(bot: Bot, guildId: bigint, options: ModifyGuild)
|
||||
options.splash = await bot.utils.urlToBase64(options.splash);
|
||||
}
|
||||
|
||||
const result = await bot.rest.runMethod<Guild>(bot.rest,"patch", bot.constants.endpoints.GUILDS_BASE(guildId), {
|
||||
|
||||
});
|
||||
const result = await bot.rest.runMethod<Guild>(bot.rest, "patch", bot.constants.endpoints.GUILDS_BASE(guildId), {});
|
||||
|
||||
const cached = await bot.cache.guilds.get(guildId);
|
||||
return bot.transformers.guild(
|
||||
bot,
|
||||
{
|
||||
return bot.transformers.guild(bot, {
|
||||
guild: result,
|
||||
shardId: cached?.shardId || Number((BigInt(result.id) >> 22n % BigInt(bot.gateway.botGatewayData.shards)).toString())
|
||||
}
|
||||
);
|
||||
shardId:
|
||||
cached?.shardId || Number((BigInt(result.id) >> 22n % BigInt(bot.gateway.botGatewayData.shards)).toString()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ export async function editWelcomeScreen(bot: Bot, guildId: bigint, options: Modi
|
||||
channel_id: welcomeScreen.channelId,
|
||||
description: welcomeScreen.description,
|
||||
emoji_id: welcomeScreen.emojiId,
|
||||
emoji_name: welcomeScreen.emojiName
|
||||
}
|
||||
emoji_name: welcomeScreen.emojiName,
|
||||
};
|
||||
}),
|
||||
description: options.description
|
||||
description: options.description,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,15 +6,10 @@ import type { Bot } from "../../bot.ts";
|
||||
export async function getAuditLogs(bot: Bot, guildId: bigint, options?: GetGuildAuditLog) {
|
||||
await bot.utils.requireBotGuildPermissions(bot, guildId, ["VIEW_AUDIT_LOG"]);
|
||||
|
||||
return await bot.rest.runMethod<AuditLog>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.GUILD_AUDIT_LOGS(guildId),
|
||||
{
|
||||
return await bot.rest.runMethod<AuditLog>(bot.rest, "get", bot.constants.endpoints.GUILD_AUDIT_LOGS(guildId), {
|
||||
user_id: options.userId,
|
||||
action_type: options.actionType,
|
||||
before: options.before,
|
||||
limit: options?.limit && options.limit >= 1 && options.limit <= 100 ? options.limit : 50,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,13 +20,10 @@ export async function getGuild(
|
||||
with_counts: options.counts,
|
||||
});
|
||||
|
||||
const guild = await bot.transformers.guild(
|
||||
bot,
|
||||
{
|
||||
const guild = await bot.transformers.guild(bot, {
|
||||
guild: result,
|
||||
shardId: Number((BigInt(guildId) >> 22n) % BigInt(ws.botGatewayData.shards))
|
||||
}
|
||||
);
|
||||
shardId: Number((BigInt(guildId) >> 22n) % BigInt(ws.botGatewayData.shards)),
|
||||
});
|
||||
|
||||
if (options.addToCache) {
|
||||
await bot.cache.guilds.set(guild.id, guild);
|
||||
|
||||
@@ -10,10 +10,17 @@ export async function getPruneCount(bot: Bot, guildId: bigint, options?: GetGuil
|
||||
|
||||
await bot.utils.requireBotGuildPermissions(guildId, ["KICK_MEMBERS"]);
|
||||
|
||||
const result = await bot.rest.runMethod(bot.rest,"get", bot.constants.endpoints.GUILD_PRUNE(guildId), options ? {
|
||||
const result = await bot.rest.runMethod(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.GUILD_PRUNE(guildId),
|
||||
options
|
||||
? {
|
||||
days: options.days,
|
||||
include_roles: options.includeRoles
|
||||
} : {});
|
||||
include_roles: options.includeRoles,
|
||||
}
|
||||
: {}
|
||||
);
|
||||
|
||||
return result.pruned as number;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@ import type { Bot } from "../../bot.ts";
|
||||
|
||||
/** Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled. */
|
||||
export async function getVoiceRegions(boot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<VoiceRegion[]>(bot.rest,"get", bot.constants.endpoints.GUILD_REGIONS(guildId));
|
||||
const result = await bot.rest.runMethod<VoiceRegion[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.GUILD_REGIONS(guildId)
|
||||
);
|
||||
|
||||
return new Collection<string, VoiceRegion>(result.map((region) => [region.id, region]));
|
||||
}
|
||||
|
||||
@@ -2,5 +2,9 @@ import type { WelcomeScreen } from "../../types/guilds/welcome_screen.ts";
|
||||
import type { Bot } from "../../bot.ts";
|
||||
|
||||
export async function getWelcomeScreen(bot: Bot, guildId: bigint) {
|
||||
return await bot.rest.runMethod<WelcomeScreen>(bot.rset,"get", bot.constants.endpoints.GUILD_WELCOME_SCREEN(guildId));
|
||||
return await bot.rest.runMethod<WelcomeScreen>(
|
||||
bot.rset,
|
||||
"get",
|
||||
bot.constants.endpoints.GUILD_WELCOME_SCREEN(guildId)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,5 +9,9 @@ export async function getWidget(bot: Bot, guildId: bigint, options?: { force: bo
|
||||
if (!guild?.widgetEnabled) throw new Error(bot.constants.Errors.GUILD_WIDGET_NOT_ENABLED);
|
||||
}
|
||||
|
||||
return await bot.rest.runMethod<GuildWidgetDetails>(bot.rest,"get", `${bot.constants.endpoints.GUILD_WIDGET(guildId)}.json`);
|
||||
return await bot.rest.runMethod<GuildWidgetDetails>(
|
||||
bot.rest,
|
||||
"get",
|
||||
`${bot.constants.endpoints.GUILD_WIDGET(guildId)}.json`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,11 @@ import type { Bot } from "../../bot.ts";
|
||||
import type { GetGuildWidgetImageQuery } from "../../types/guilds/get_guild_widget_image.ts";
|
||||
|
||||
/** Returns the widget image URL for the guild. */
|
||||
export async function getWidgetImageURL(bot: Bot, guildId: bigint, options?: GetGuildWidgetImageQuery & { force?: boolean }) {
|
||||
export async function getWidgetImageURL(
|
||||
bot: Bot,
|
||||
guildId: bigint,
|
||||
options?: GetGuildWidgetImageQuery & { force?: boolean }
|
||||
) {
|
||||
if (!options?.force) {
|
||||
const guild = await bot.cache.guilds.get(guildId);
|
||||
if (!guild) throw new Error(bot.constants.Errors.GUILD_NOT_FOUND);
|
||||
|
||||
@@ -17,7 +17,9 @@ export function guildIconURL(
|
||||
? bot.utils.formatImageURL(
|
||||
bot.constants.endpoints.GUILD_ICON(
|
||||
id,
|
||||
typeof options.icon === "string" ? options.icon : bot.utils.iconBigintToHash(options.icon, options.animated ?? true)
|
||||
typeof options.icon === "string"
|
||||
? options.icon
|
||||
: bot.utils.iconBigintToHash(options.icon, options.animated ?? true)
|
||||
),
|
||||
options.size || 128,
|
||||
options.format
|
||||
|
||||
Reference in New Issue
Block a user