From 6b99ed9b74753b8d7df679ec734ba6491a08c259 Mon Sep 17 00:00:00 2001 From: Histmy Date: Thu, 9 Dec 2021 21:26:28 +0100 Subject: [PATCH] function joinVoice has defined overloads --- package-lock.json | 4 ++-- package.json | 2 +- src/utils/types.ts | 6 ++++++ src/utils/utils.ts | 6 ++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6af42e7..6015799 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "denim_3001", - "version": "3001.33.1", + "version": "3001.34.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "denim_3001", - "version": "3001.33.1", + "version": "3001.34.0", "license": "ISC", "dependencies": { "@discordjs/opus": "github:discordjs/opus", diff --git a/package.json b/package.json index ce9ef54..1dce814 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "denim_3001", - "version": "3001.33.1", + "version": "3001.34.0", "description": "Toto je velmi kvalitní bot.", "repository": { "url": "https://github.com/Histmy/Denim-Bot/" diff --git a/src/utils/types.ts b/src/utils/types.ts index 2e38a17..5c3d924 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,3 +1,4 @@ +import { VoiceConnection } from "@discordjs/voice"; import { Client, ClientEvents, ClientPresenceStatusData, Message, MessageOptions, User } from "discord.js"; type OutputRunFunkce = string | MessageOptions | void; @@ -71,3 +72,8 @@ export interface MuzikaFace { export type KoamndNaExport = { name: string; } & BaseKomandProps; + +export interface JoinHovna { + conn: VoiceConnection; + prev: string | boolean; +}; diff --git a/src/utils/utils.ts b/src/utils/utils.ts index d21614e..75d7bdc 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,7 +1,7 @@ import { AudioPlayerStatus, AudioResource, createAudioPlayer, createAudioResource, entersState, getVoiceConnection, joinVoiceChannel, PlayerSubscription, VoiceConnection, VoiceConnectionStatus } from "@discordjs/voice"; import { Guild, StageChannel, VoiceChannel } from "discord.js"; import { once } from "events"; -import { MuzikaFace, SRecord } from "./types"; +import { JoinHovna, MuzikaFace, SRecord } from "./types"; import { existsSync } from "fs"; import { Readable } from "node:stream"; @@ -63,7 +63,9 @@ export const formatCas = (cas: number) => { return `${h} hodin ${m} mynut a ${s} se kund`; }; -export const joinVoice = async (channel: VoiceChannel | StageChannel | string, guild?: Guild) => { +export async function joinVoice(channel: VoiceChannel | StageChannel): Promise; +export async function joinVoice(channel: string, guild: Guild): Promise; +export async function joinVoice(channel: VoiceChannel | StageChannel | string, guild?: Guild): Promise { const channelId = typeof channel === "string" ? channel : channel.id; const guildId = typeof channel === "string" ? guild!.id : channel.guildId; const guilda = typeof channel === "string" ? guild! : channel.guild;