mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
fix: more typings errors
This commit is contained in:
@@ -2,15 +2,21 @@ import { CreateGuildBan } from "../../types/guilds/create_guild_ban.ts";
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { requireBotGuildPermissions } from "../../util/permissions.ts";
|
||||
import { camelKeysToSnakeCase } from "../../util/utils.ts";
|
||||
|
||||
/** Ban a user from the guild and optionally delete previous messages sent by the user. Requires the BAN_MEMBERS permission. */
|
||||
export async function ban(guildId: string, id: string, options: CreateGuildBan) {
|
||||
export async function ban(
|
||||
guildId: string,
|
||||
id: string,
|
||||
options: CreateGuildBan
|
||||
) {
|
||||
await requireBotGuildPermissions(guildId, ["BAN_MEMBERS"]);
|
||||
|
||||
const result = await rest.runMethod("put", endpoints.GUILD_BAN(guildId, id), {
|
||||
...options,
|
||||
delete_message_days: options.days,
|
||||
});
|
||||
const result = await rest.runMethod(
|
||||
"put",
|
||||
endpoints.GUILD_BAN(guildId, id),
|
||||
camelKeysToSnakeCase(options)
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
requireBotChannelPermissions,
|
||||
requireBotGuildPermissions,
|
||||
} from "../../util/permissions.ts";
|
||||
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||
import { camelKeysToSnakeCase, snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||
|
||||
/** Edit the member */
|
||||
export async function editMember(
|
||||
@@ -32,7 +32,7 @@ export async function editMember(
|
||||
if (
|
||||
typeof options.mute !== "undefined" ||
|
||||
typeof options.deaf !== "undefined" ||
|
||||
(typeof options.channel_id !== "undefined" || "null")
|
||||
(typeof options.channelId !== "undefined" || "null")
|
||||
) {
|
||||
const memberVoiceState = (await cacheHandlers.get("guilds", guildId))
|
||||
?.voiceStates.get(memberId);
|
||||
@@ -49,7 +49,7 @@ export async function editMember(
|
||||
requiredPerms.add("DEAFEN_MEMBERS");
|
||||
}
|
||||
|
||||
if (options.channel_id) {
|
||||
if (options.channelId) {
|
||||
const requiredVoicePerms: Set<PermissionStrings> = new Set([
|
||||
"CONNECT",
|
||||
"MOVE_MEMBERS",
|
||||
@@ -61,7 +61,7 @@ export async function editMember(
|
||||
);
|
||||
}
|
||||
await requireBotChannelPermissions(
|
||||
options.channel_id,
|
||||
options.channelId,
|
||||
[...requiredVoicePerms],
|
||||
);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ export async function editMember(
|
||||
const result = await rest.runMethod(
|
||||
"patch",
|
||||
endpoints.GUILD_MEMBER(guildId, memberId),
|
||||
options,
|
||||
camelKeysToSnakeCase(options),
|
||||
) as DiscordGuildMember;
|
||||
const member = await structures.createDiscordenoMember(
|
||||
snakeKeysToCamelCase(result),
|
||||
|
||||
@@ -11,5 +11,5 @@ export function moveMember(
|
||||
memberId: string,
|
||||
channelId: string,
|
||||
) {
|
||||
return editMember(guildId, memberId, { channel_id: channelId });
|
||||
return editMember(guildId, memberId, { channelId });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user