diff --git a/dist/index.d.mts b/dist/index.d.mts deleted file mode 100644 index 8a8d0a0..0000000 --- a/dist/index.d.mts +++ /dev/null @@ -1,24 +0,0 @@ -type startParameters = { - VoiceChannelID: number; - GuildID: number; - VoiceAdapter: number; - Type: string; - Resource: string; -}; - -type stopParameter = { - GuildID: number; -}; - -type maxListenerParameter = { - GuildID: number; - MaxListeners: number; -}; - -declare function start({ VoiceChannelID, GuildID, VoiceAdapter, Type, Resource, }: startParameters): void; - -declare function stop({ GuildID, }: stopParameter): void; - -declare function setMaxListeners({ GuildID, MaxListeners, }: maxListenerParameter): void; - -export { setMaxListeners, start, stop }; diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 8a8d0a0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -type startParameters = { - VoiceChannelID: number; - GuildID: number; - VoiceAdapter: number; - Type: string; - Resource: string; -}; - -type stopParameter = { - GuildID: number; -}; - -type maxListenerParameter = { - GuildID: number; - MaxListeners: number; -}; - -declare function start({ VoiceChannelID, GuildID, VoiceAdapter, Type, Resource, }: startParameters): void; - -declare function stop({ GuildID, }: stopParameter): void; - -declare function setMaxListeners({ GuildID, MaxListeners, }: maxListenerParameter): void; - -export { setMaxListeners, start, stop }; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d39a8d3..0000000 --- a/dist/index.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/index.ts -var src_exports = {}; -__export(src_exports, { - setMaxListeners: () => setMaxListeners, - start: () => start, - stop: () => stop -}); -module.exports = __toCommonJS(src_exports); - -// src/utility/errorFunc.ts -function ERR(err) { - console.error(" "); - console.error(" ______ _____ _____ ____ _____ \r\n | ____| __ \\| __ \\ / __ \\| __ \\ \r\n | |__ | |__) | |__) | | | | |__) |\r\n | __| | _ /| _ /| | | | _ / \r\n | |____| | \\ \\| | \\ \\| |__| | | \\ \\ \r\n |______|_| \\_\\_| \\_\\\\____/|_| \\_\\"); - console.error(" "); - console.error("This error comes from the discord-audio-stream package!"); - console.error("This error occurs if you are not using the package correctly, sometimes it can also be bugs in the package."); - console.error(" "); - console.error("See the docs or open a issue post on github."); - console.error(" "); - if (err) { - console.error(err); - } -} - -// src/functions/startFunc.ts -var import_node_path = require("path"); -var { joinVoiceChannel, createAudioPlayer, createAudioResource } = require("@discordjs/voice"); -function start({ - VoiceChannelID, - GuildID, - VoiceAdapter, - Type, - Resource -}) { - try { - let streamFile2 = function(FILE) { - let Audio = createAudioResource((0, import_node_path.join)(__dirname, FILE), { inlineVolume: true }); - AudioPlayer.play(Audio); - joinVoiceChannel({ - channelId: VoiceChannelID, - guildId: GuildID, - adapterCreator: VoiceAdapter - }).subscribe(AudioPlayer); - }, streamLink2 = function(URL) { - let Audio = createAudioResource(URL); - AudioPlayer.play(Audio); - joinVoiceChannel({ - channelId: VoiceChannelID, - guildId: GuildID, - adapterCreator: VoiceAdapter - }).subscribe(AudioPlayer); - }, LinkValidation2 = function(URL) { - var URLPattern = new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$", "i"); - return URLPattern.test(URL); - }, FileValidation2 = function(FILE) { - var FILEPattern = new RegExp("^(.+)/([^/]+)$"); - return FILEPattern.test(FILE); - }; - var streamFile = streamFile2, streamLink = streamLink2, LinkValidation = LinkValidation2, FileValidation = FileValidation2; - const AudioPlayer = createAudioPlayer(); - switch (Type) { - case "Link": - streamLink2(Resource); - break; - case "File": - streamFile2(Resource); - break; - case "Analyze": - if (LinkValidation2(Resource)) { - streamLink2(Resource); - } else if (FileValidation2(Resource)) { - streamFile2(Resource); - } else { - ERR(); - } - break; - default: - ERR(); - break; - } - } catch (err) { - ERR(err); - } -} - -// src/functions/stopFunc.ts -var { getVoiceConnection } = require("@discordjs/voice"); -function stop({ - GuildID -}) { - try { - const connection = getVoiceConnection(GuildID); - connection.destroy(); - } catch (err) { - ERR(err); - } -} - -// src/functions/maxListenersFunc.ts -var { getVoiceConnection: getVoiceConnection2 } = require("@discordjs/voice"); -function setMaxListeners({ - GuildID, - MaxListeners -}) { - try { - const connection = getVoiceConnection2(GuildID); - connection.setMaxListeners(MaxListeners); - } catch (err) { - ERR(err); - } -} -// Annotate the CommonJS export names for ESM import in node: -0 && (module.exports = { - setMaxListeners, - start, - stop -}); diff --git a/dist/index.mjs b/dist/index.mjs deleted file mode 100644 index ee14ead..0000000 --- a/dist/index.mjs +++ /dev/null @@ -1,121 +0,0 @@ -var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { - get: (a, b) => (typeof require !== "undefined" ? require : a)[b] -}) : x)(function(x) { - if (typeof require !== "undefined") return require.apply(this, arguments); - throw Error('Dynamic require of "' + x + '" is not supported'); -}); - -// node_modules/tsup/assets/esm_shims.js -import { fileURLToPath } from "url"; -import path from "path"; -var getFilename = () => fileURLToPath(import.meta.url); -var getDirname = () => path.dirname(getFilename()); -var __dirname = /* @__PURE__ */ getDirname(); - -// src/utility/errorFunc.ts -function ERR(err) { - console.error(" "); - console.error(" ______ _____ _____ ____ _____ \r\n | ____| __ \\| __ \\ / __ \\| __ \\ \r\n | |__ | |__) | |__) | | | | |__) |\r\n | __| | _ /| _ /| | | | _ / \r\n | |____| | \\ \\| | \\ \\| |__| | | \\ \\ \r\n |______|_| \\_\\_| \\_\\\\____/|_| \\_\\"); - console.error(" "); - console.error("This error comes from the discord-audio-stream package!"); - console.error("This error occurs if you are not using the package correctly, sometimes it can also be bugs in the package."); - console.error(" "); - console.error("See the docs or open a issue post on github."); - console.error(" "); - if (err) { - console.error(err); - } -} - -// src/functions/startFunc.ts -import { join } from "node:path"; -var { joinVoiceChannel, createAudioPlayer, createAudioResource } = __require("@discordjs/voice"); -function start({ - VoiceChannelID, - GuildID, - VoiceAdapter, - Type, - Resource -}) { - try { - let streamFile2 = function(FILE) { - let Audio = createAudioResource(join(__dirname, FILE), { inlineVolume: true }); - AudioPlayer.play(Audio); - joinVoiceChannel({ - channelId: VoiceChannelID, - guildId: GuildID, - adapterCreator: VoiceAdapter - }).subscribe(AudioPlayer); - }, streamLink2 = function(URL) { - let Audio = createAudioResource(URL); - AudioPlayer.play(Audio); - joinVoiceChannel({ - channelId: VoiceChannelID, - guildId: GuildID, - adapterCreator: VoiceAdapter - }).subscribe(AudioPlayer); - }, LinkValidation2 = function(URL) { - var URLPattern = new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$", "i"); - return URLPattern.test(URL); - }, FileValidation2 = function(FILE) { - var FILEPattern = new RegExp("^(.+)/([^/]+)$"); - return FILEPattern.test(FILE); - }; - var streamFile = streamFile2, streamLink = streamLink2, LinkValidation = LinkValidation2, FileValidation = FileValidation2; - const AudioPlayer = createAudioPlayer(); - switch (Type) { - case "Link": - streamLink2(Resource); - break; - case "File": - streamFile2(Resource); - break; - case "Analyze": - if (LinkValidation2(Resource)) { - streamLink2(Resource); - } else if (FileValidation2(Resource)) { - streamFile2(Resource); - } else { - ERR(); - } - break; - default: - ERR(); - break; - } - } catch (err) { - ERR(err); - } -} - -// src/functions/stopFunc.ts -var { getVoiceConnection } = __require("@discordjs/voice"); -function stop({ - GuildID -}) { - try { - const connection = getVoiceConnection(GuildID); - connection.destroy(); - } catch (err) { - ERR(err); - } -} - -// src/functions/maxListenersFunc.ts -var { getVoiceConnection: getVoiceConnection2 } = __require("@discordjs/voice"); -function setMaxListeners({ - GuildID, - MaxListeners -}) { - try { - const connection = getVoiceConnection2(GuildID); - connection.setMaxListeners(MaxListeners); - } catch (err) { - ERR(err); - } -} -export { - setMaxListeners, - start, - stop -};