fix some errors

This commit is contained in:
ITOH
2021-04-30 21:53:17 +02:00
parent 9aad8c257e
commit 208b098ba2
4 changed files with 8 additions and 14 deletions
+3 -8
View File
@@ -2,16 +2,11 @@ import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
DiscordVoiceState,
VoiceState,
} from "../../types/voice/voice_state.ts";
import { snakeKeysToCamelCase } from "../../util/utils.ts";
import { VoiceState } from "../../types/voice/voice_state.ts";
export async function handleVoiceStateUpdate(data: DiscordGatewayPayload) {
const payload = snakeKeysToCamelCase<VoiceState>(
data.d as DiscordVoiceState,
);
const payload = data.d as VoiceState;
if (!payload.guildId) return;
const guild = await cacheHandlers.get("guilds", payload.guildId);
@@ -1,9 +1,9 @@
import { rest } from "../../rest/rest.ts";
import { DiscordValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
import { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
import { endpoints } from "../../util/constants.ts";
export async function validDiscoveryTerm(term: string) {
const result = await rest.runMethod<DiscordValidateDiscoverySearchTerm>(
const result = await rest.runMethod<ValidateDiscoverySearchTerm>(
"get",
endpoints.DISCOVERY_VALID_TERM,
{ term },
+2 -2
View File
@@ -4,7 +4,7 @@ import { structures } from "../../structures/mod.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts";
import { CreateMessage } from "../../types/messages/create_message.ts";
import { DiscordMessage, Message } from "../../types/messages/message.ts";
import { Message } from "../../types/messages/message.ts";
import { Errors } from "../../types/misc/errors.ts";
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import { endpoints } from "../../util/constants.ts";
@@ -96,7 +96,7 @@ export async function sendMessage(
const result = await rest.runMethod<Message>(
"post",
endpoints.CHANNEL_MESSAGES(channelId),
camelKeysToSnakeCase<DiscordMessage>({
camelKeysToSnakeCase({
...content,
...(content.messageReference?.messageId
? {
@@ -1,6 +1,5 @@
// TODO: add docs link
export interface ValidateDiscoverySearchTerm {
/** Whether the provided term is valid */
valid: boolean;
}
export type DiscordValidateDiscoverySearchTerm = ValidateDiscoverySearchTerm;