fix: more typings errors

This commit is contained in:
Skillz4Killz
2021-04-12 20:02:56 +00:00
committed by GitHub
parent 2fc28165f3
commit 9a7747b7ab
8 changed files with 32 additions and 28 deletions
+11 -5
View File
@@ -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;
}
+5 -5
View File
@@ -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),
+1 -1
View File
@@ -11,5 +11,5 @@ export function moveMember(
memberId: string,
channelId: string,
) {
return editMember(guildId, memberId, { channel_id: channelId });
return editMember(guildId, memberId, { channelId });
}