mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
change: prettier code
This commit is contained in:
committed by
GitHub Action
parent
0f91120769
commit
370d62be04
@@ -5,9 +5,5 @@ import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
|
||||
export async function handleGuildBanAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<GuildBanAddRemove>;
|
||||
bot.events.guildBanAdd(
|
||||
bot,
|
||||
bot.transformers.user(bot, payload.user),
|
||||
bot.transformers.snowflake(payload.guild_id)
|
||||
);
|
||||
bot.events.guildBanAdd(bot, bot.transformers.user(bot, payload.user), bot.transformers.snowflake(payload.guild_id));
|
||||
}
|
||||
|
||||
@@ -3,11 +3,7 @@ import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.
|
||||
import type { Guild } from "../../types/guilds/guild.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
|
||||
export function handleGuildLoaded(
|
||||
bot: Bot,
|
||||
data: DiscordGatewayPayload,
|
||||
shardId: number
|
||||
) {
|
||||
export function handleGuildLoaded(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<Guild>;
|
||||
|
||||
const guild = bot.transformers.guild(bot, { guild: payload, shardId });
|
||||
|
||||
@@ -6,11 +6,9 @@ import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
export async function handleMessageDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<MessageDelete>;
|
||||
|
||||
bot.events.messageDelete(bot,
|
||||
{
|
||||
bot.events.messageDelete(bot, {
|
||||
id: bot.transformers.snowflake(payload.id),
|
||||
channelId: bot.transformers.snowflake(payload.channel_id),
|
||||
guildId: payload.guild_id ? bot.transformers.snowflake(payload.guild_id) : undefined,
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,5 +5,8 @@ import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
|
||||
export async function handleGuildRoleDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as SnakeCasedPropertiesDeep<GuildRoleDelete>;
|
||||
bot.events.roleDelete(bot, { roleId: bot.transformers.snowflake(payload.role_id), guildId: bot.transformers.snowflake(payload.guild_id) });
|
||||
bot.events.roleDelete(bot, {
|
||||
roleId: bot.transformers.snowflake(payload.role_id),
|
||||
guildId: bot.transformers.snowflake(payload.guild_id),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
|
||||
/** Delete the channel permission overwrites for a user or role in this channel. Requires `MANAGE_ROLES` permission. */
|
||||
export async function deleteChannelOverwrite(
|
||||
bot: Bot,
|
||||
channelId: bigint,
|
||||
overwriteId: bigint
|
||||
): Promise<undefined> {
|
||||
export async function deleteChannelOverwrite(bot: Bot, channelId: bigint, overwriteId: bigint): Promise<undefined> {
|
||||
return await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
|
||||
@@ -28,12 +28,14 @@ export async function sendInteractionResponse(
|
||||
options.data = { ...options.data, allowedMentions: { parse: [] } };
|
||||
}
|
||||
|
||||
const allowedMentions: AllowedMentions = options.data?.allowedMentions ? {
|
||||
const allowedMentions: AllowedMentions = options.data?.allowedMentions
|
||||
? {
|
||||
parse: options.data?.allowedMentions.parse,
|
||||
repliedUser: options.data?.allowedMentions.repliedUser,
|
||||
users: options.data?.allowedMentions.users?.map(id => id.toString()),
|
||||
roles: options.data?.allowedMentions.roles?.map(id => id.toString()),
|
||||
} : { parse: [] };
|
||||
users: options.data?.allowedMentions.users?.map((id) => id.toString()),
|
||||
roles: options.data?.allowedMentions.roles?.map((id) => id.toString()),
|
||||
}
|
||||
: { parse: [] };
|
||||
|
||||
// If its already been executed, we need to send a followup response
|
||||
if (bot.cache.executedSlashCommands.has(token)) {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
|
||||
/** Edit the nickname of the bot in this guild */
|
||||
export async function editBotNickname(
|
||||
bot: Bot,
|
||||
guildId: bigint,
|
||||
options: { nick: string | null; reason?: string }
|
||||
) {
|
||||
export async function editBotNickname(bot: Bot, guildId: bigint, options: { nick: string | null; reason?: string }) {
|
||||
const response = await bot.rest.runMethod<{ nick: string }>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
|
||||
@@ -4,18 +4,13 @@ import type { Bot } from "../../bot.ts";
|
||||
|
||||
/** Edit a guild role. Requires the MANAGE_ROLES permission. */
|
||||
export async function editRole(bot: Bot, guildId: bigint, id: bigint, options: CreateGuildRole) {
|
||||
const result = await bot.rest.runMethod<Role>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
bot.constants.endpoints.GUILD_ROLE(guildId, id),
|
||||
{
|
||||
const result = await bot.rest.runMethod<Role>(bot.rest, "patch", bot.constants.endpoints.GUILD_ROLE(guildId, id), {
|
||||
name: options.name,
|
||||
color: options.color,
|
||||
hoist: options.hoist,
|
||||
mentionable: options.mentionable,
|
||||
permissions: options.permissions ? bot.utils.calculateBits(options.permissions) : undefined,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
return bot.transformers.role(bot, { role: result, guildId });
|
||||
}
|
||||
|
||||
@@ -7,7 +7,11 @@ import type { Bot } from "../../bot.ts";
|
||||
* Requires the `MANAGE_GUILD` permission.
|
||||
*/
|
||||
export async function getGuildTemplates(bot: Bot, guildId: bigint) {
|
||||
const templates = await bot.rest.runMethod<Template[]>(bot.rest, "get", bot.constants.endpoints.GUILD_TEMPLATES(guildId));
|
||||
const templates = await bot.rest.runMethod<Template[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.GUILD_TEMPLATES(guildId)
|
||||
);
|
||||
|
||||
return new Collection(templates.map((template) => [template.code, template]));
|
||||
}
|
||||
|
||||
@@ -16,13 +16,8 @@ export async function createWebhook(bot: Bot, channelId: bigint, options: Create
|
||||
throw new Error(bot.constants.Errors.INVALID_WEBHOOK_NAME);
|
||||
}
|
||||
|
||||
return await bot.rest.runMethod<Webhook>(
|
||||
bot.rest,
|
||||
"post",
|
||||
bot.constants.endpoints.CHANNEL_WEBHOOKS(channelId),
|
||||
{
|
||||
return await bot.rest.runMethod<Webhook>(bot.rest, "post", bot.constants.endpoints.CHANNEL_WEBHOOKS(channelId), {
|
||||
...options,
|
||||
avatar: options.avatar ? await bot.utils.urlToBase64(options.avatar) : undefined,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,11 +5,7 @@ import type { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
|
||||
/** Returns a list of guild webhooks objects. Requires the MANAGE_WEBHOOKs permission. */
|
||||
export async function getWebhooks(bot: Bot, guildId: bigint) {
|
||||
const result = await bot.rest.runMethod<Webhook[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.GUILD_WEBHOOKS(guildId)
|
||||
);
|
||||
const result = await bot.rest.runMethod<Webhook[]>(bot.rest, "get", bot.constants.endpoints.GUILD_WEBHOOKS(guildId));
|
||||
|
||||
return new Collection(result.map((webhook) => [webhook.id, webhook]));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ export function transformRole(
|
||||
};
|
||||
}
|
||||
|
||||
export interface DiscordenoRole extends Omit<Role, "tags" | "id" | "permissions" | "hoist" | "mentionable" | "managed" | "icon"> {
|
||||
export interface DiscordenoRole
|
||||
extends Omit<Role, "tags" | "id" | "permissions" | "hoist" | "mentionable" | "managed" | "icon"> {
|
||||
/** The role id */
|
||||
id: bigint;
|
||||
/** The bot id that is associated with this role. */
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ export function identify(gateway: GatewayManager, shardId: number, maxShards: nu
|
||||
},
|
||||
intents: gateway.intents,
|
||||
shard: [shardId, maxShards],
|
||||
presence: gateway.presence
|
||||
presence: gateway.presence,
|
||||
},
|
||||
},
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user