Add files via upload
This commit is contained in:
@@ -29,26 +29,36 @@ yarn add discord-audio-stream
|
|||||||
|
|
||||||
### Code Snippet - Start
|
### Code Snippet - Start
|
||||||
```js
|
```js
|
||||||
const Audio = require("discord-audio-stream");
|
const AudioStream = require("discord-audio-stream");
|
||||||
|
|
||||||
Audio.StreamStart({
|
AudioStream.start({
|
||||||
imvci: 0, //Voice Channel ID e.g. interaction.member.voice.channel.id
|
VoiceChannelID: 0, //Integer | Voice Channel ID | e.g interaction.member.voice.channel.id
|
||||||
igi: 0, //Guild ID e.g. interaction.guild.id
|
GuildID: 0, //Integer | Guild ID | e.g interaction.guild.id
|
||||||
igv: 0, //Bot Voice Adapter e.g. interaction.guild.voiceAdapterCreator
|
VoiceAdapter: 0, //Integer | Voice Adapter Creator | e.g interaction.guild.voiceAdapterCreator
|
||||||
type: "", //Choose the Stream resource - File or Link or Analyze
|
Type: "", //String | choose the Audio Resource [File or Link or Analyze] | Analyze
|
||||||
Resource: "", //Link to File e.g. ../assets/Stream.mp3 or Link to Audio Stream
|
Resource: "", //String | Audio Stream Link or File Location | e.g https://synradiode.stream.laut.fm/synradiode
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
### Code Snippet - Stop
|
### Code Snippet - Stop
|
||||||
```js
|
```js
|
||||||
const Audio = require("discord-audio-stream");
|
const AudioStream = require("discord-audio-stream");
|
||||||
|
|
||||||
Audio.StreamStart({
|
AudioStream.stop({
|
||||||
igi: 0, //Guild ID e.g. interaction.guild.id
|
GuildID: 0, //Integer | Guild ID | e.g interaction.guild.id
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
### Code Snippet - Set Max Listeners
|
||||||
|
```js
|
||||||
|
const AudioStream = require("discord-audio-stream");
|
||||||
|
|
||||||
|
AudioStream.setMaxListeners({
|
||||||
|
GuildID: 0, //Integer | Guild ID | e.g interaction.guild.id
|
||||||
|
MaxListeners: 0, //Integer | max Listeners | e.g 30
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🤝 Enjoy the package?
|
## 🤝 Enjoy the package?
|
||||||
|
|
||||||
Give it a star ⭐ on [github](https://github.com/FrauJulian/discord-audio-stream) or [donate](https://buymeacoffee.com/fraujuliannn) a hot chocolate!
|
Give it a star ⭐ on [github](https://github.com/FrauJulian/discord-audio-stream) or [buy](https://buymeacoffee.com/fraujuliannn) a hot chocolate!
|
||||||
Vendored
+15
-8
@@ -1,17 +1,24 @@
|
|||||||
type startParameters = {
|
type startParameters = {
|
||||||
imvci: number;
|
VoiceChannelID: number;
|
||||||
igi: number;
|
GuildID: number;
|
||||||
igv: number;
|
VoiceAdapter: number;
|
||||||
type: string;
|
Type: string;
|
||||||
Resource: string;
|
Resource: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type stopParameter = {
|
type stopParameter = {
|
||||||
igi: number;
|
GuildID: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
declare function start({ imvci, igi, igv, type, Resource, }: startParameters): void;
|
type maxListenerParameter = {
|
||||||
|
GuildID: number;
|
||||||
|
MaxListeners: number;
|
||||||
|
};
|
||||||
|
|
||||||
declare function stop({ igi, }: stopParameter): void;
|
declare function start({ VoiceChannelID, GuildID, VoiceAdapter, Type, Resource, }: startParameters): void;
|
||||||
|
|
||||||
export { start, stop };
|
declare function stop({ GuildID, }: stopParameter): void;
|
||||||
|
|
||||||
|
declare function setMaxListeners({ GuildID, MaxListeners, }: maxListenerParameter): void;
|
||||||
|
|
||||||
|
export { setMaxListeners, start, stop };
|
||||||
|
|||||||
Vendored
+15
-8
@@ -1,17 +1,24 @@
|
|||||||
type startParameters = {
|
type startParameters = {
|
||||||
imvci: number;
|
VoiceChannelID: number;
|
||||||
igi: number;
|
GuildID: number;
|
||||||
igv: number;
|
VoiceAdapter: number;
|
||||||
type: string;
|
Type: string;
|
||||||
Resource: string;
|
Resource: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type stopParameter = {
|
type stopParameter = {
|
||||||
igi: number;
|
GuildID: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
declare function start({ imvci, igi, igv, type, Resource, }: startParameters): void;
|
type maxListenerParameter = {
|
||||||
|
GuildID: number;
|
||||||
|
MaxListeners: number;
|
||||||
|
};
|
||||||
|
|
||||||
declare function stop({ igi, }: stopParameter): void;
|
declare function start({ VoiceChannelID, GuildID, VoiceAdapter, Type, Resource, }: startParameters): void;
|
||||||
|
|
||||||
export { start, stop };
|
declare function stop({ GuildID, }: stopParameter): void;
|
||||||
|
|
||||||
|
declare function setMaxListeners({ GuildID, MaxListeners, }: maxListenerParameter): void;
|
||||||
|
|
||||||
|
export { setMaxListeners, start, stop };
|
||||||
|
|||||||
Vendored
+34
-26
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|||||||
// src/index.ts
|
// src/index.ts
|
||||||
var src_exports = {};
|
var src_exports = {};
|
||||||
__export(src_exports, {
|
__export(src_exports, {
|
||||||
|
setMaxListeners: () => setMaxListeners,
|
||||||
start: () => start,
|
start: () => start,
|
||||||
stop: () => stop
|
stop: () => stop
|
||||||
});
|
});
|
||||||
@@ -44,10 +45,10 @@ function ERR(err) {
|
|||||||
var import_node_path = require("path");
|
var import_node_path = require("path");
|
||||||
var { joinVoiceChannel, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
|
var { joinVoiceChannel, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
|
||||||
function start({
|
function start({
|
||||||
imvci,
|
VoiceChannelID,
|
||||||
igi,
|
GuildID,
|
||||||
igv,
|
VoiceAdapter,
|
||||||
type,
|
Type,
|
||||||
Resource
|
Resource
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
@@ -55,17 +56,17 @@ function start({
|
|||||||
let Audio = createAudioResource((0, import_node_path.join)(__dirname, FILE), { inlineVolume: true });
|
let Audio = createAudioResource((0, import_node_path.join)(__dirname, FILE), { inlineVolume: true });
|
||||||
AudioPlayer.play(Audio);
|
AudioPlayer.play(Audio);
|
||||||
joinVoiceChannel({
|
joinVoiceChannel({
|
||||||
channelId: imvci,
|
channelId: VoiceChannelID,
|
||||||
guildId: igi,
|
guildId: GuildID,
|
||||||
adapterCreator: igv
|
adapterCreator: VoiceAdapter
|
||||||
}).subscribe(AudioPlayer);
|
}).subscribe(AudioPlayer);
|
||||||
}, streamLink2 = function(URL) {
|
}, streamLink2 = function(URL) {
|
||||||
let Audio = createAudioResource(URL);
|
let Audio = createAudioResource(URL);
|
||||||
AudioPlayer.play(Audio);
|
AudioPlayer.play(Audio);
|
||||||
joinVoiceChannel({
|
joinVoiceChannel({
|
||||||
channelId: imvci,
|
channelId: VoiceChannelID,
|
||||||
guildId: igi,
|
guildId: GuildID,
|
||||||
adapterCreator: igv
|
adapterCreator: VoiceAdapter
|
||||||
}).subscribe(AudioPlayer);
|
}).subscribe(AudioPlayer);
|
||||||
}, LinkValidation2 = function(URL) {
|
}, 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");
|
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");
|
||||||
@@ -76,25 +77,17 @@ function start({
|
|||||||
};
|
};
|
||||||
var streamFile = streamFile2, streamLink = streamLink2, LinkValidation = LinkValidation2, FileValidation = FileValidation2;
|
var streamFile = streamFile2, streamLink = streamLink2, LinkValidation = LinkValidation2, FileValidation = FileValidation2;
|
||||||
const AudioPlayer = createAudioPlayer();
|
const AudioPlayer = createAudioPlayer();
|
||||||
switch (type) {
|
switch (Type) {
|
||||||
case "Link":
|
case "Link":
|
||||||
if (LinkValidation2(Resource) === true && FileValidation2(Resource) === false) {
|
streamLink2(Resource);
|
||||||
streamLink2(Resource);
|
|
||||||
} else {
|
|
||||||
ERR();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "File":
|
case "File":
|
||||||
if (LinkValidation2(Resource) === false && FileValidation2(Resource) === true) {
|
streamFile2(Resource);
|
||||||
streamFile2(Resource);
|
|
||||||
} else {
|
|
||||||
ERR();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "Analyze":
|
case "Analyze":
|
||||||
if (LinkValidation2(Resource) === true && FileValidation2(Resource) === false) {
|
if (LinkValidation2(Resource)) {
|
||||||
streamLink2(Resource);
|
streamLink2(Resource);
|
||||||
} else if (LinkValidation2(Resource) === false && FileValidation2(Resource) === true) {
|
} else if (FileValidation2(Resource)) {
|
||||||
streamFile2(Resource);
|
streamFile2(Resource);
|
||||||
} else {
|
} else {
|
||||||
ERR();
|
ERR();
|
||||||
@@ -112,17 +105,32 @@ function start({
|
|||||||
// src/functions/stopFunc.ts
|
// src/functions/stopFunc.ts
|
||||||
var { getVoiceConnection } = require("@discordjs/voice");
|
var { getVoiceConnection } = require("@discordjs/voice");
|
||||||
function stop({
|
function stop({
|
||||||
igi
|
GuildID
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
const connection = getVoiceConnection(igi);
|
const connection = getVoiceConnection(GuildID);
|
||||||
connection.destroy();
|
connection.destroy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
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:
|
// Annotate the CommonJS export names for ESM import in node:
|
||||||
0 && (module.exports = {
|
0 && (module.exports = {
|
||||||
|
setMaxListeners,
|
||||||
start,
|
start,
|
||||||
stop
|
stop
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
+33
-26
@@ -31,10 +31,10 @@ function ERR(err) {
|
|||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
var { joinVoiceChannel, createAudioPlayer, createAudioResource } = __require("@discordjs/voice");
|
var { joinVoiceChannel, createAudioPlayer, createAudioResource } = __require("@discordjs/voice");
|
||||||
function start({
|
function start({
|
||||||
imvci,
|
VoiceChannelID,
|
||||||
igi,
|
GuildID,
|
||||||
igv,
|
VoiceAdapter,
|
||||||
type,
|
Type,
|
||||||
Resource
|
Resource
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
@@ -42,17 +42,17 @@ function start({
|
|||||||
let Audio = createAudioResource(join(__dirname, FILE), { inlineVolume: true });
|
let Audio = createAudioResource(join(__dirname, FILE), { inlineVolume: true });
|
||||||
AudioPlayer.play(Audio);
|
AudioPlayer.play(Audio);
|
||||||
joinVoiceChannel({
|
joinVoiceChannel({
|
||||||
channelId: imvci,
|
channelId: VoiceChannelID,
|
||||||
guildId: igi,
|
guildId: GuildID,
|
||||||
adapterCreator: igv
|
adapterCreator: VoiceAdapter
|
||||||
}).subscribe(AudioPlayer);
|
}).subscribe(AudioPlayer);
|
||||||
}, streamLink2 = function(URL) {
|
}, streamLink2 = function(URL) {
|
||||||
let Audio = createAudioResource(URL);
|
let Audio = createAudioResource(URL);
|
||||||
AudioPlayer.play(Audio);
|
AudioPlayer.play(Audio);
|
||||||
joinVoiceChannel({
|
joinVoiceChannel({
|
||||||
channelId: imvci,
|
channelId: VoiceChannelID,
|
||||||
guildId: igi,
|
guildId: GuildID,
|
||||||
adapterCreator: igv
|
adapterCreator: VoiceAdapter
|
||||||
}).subscribe(AudioPlayer);
|
}).subscribe(AudioPlayer);
|
||||||
}, LinkValidation2 = function(URL) {
|
}, 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");
|
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");
|
||||||
@@ -63,25 +63,17 @@ function start({
|
|||||||
};
|
};
|
||||||
var streamFile = streamFile2, streamLink = streamLink2, LinkValidation = LinkValidation2, FileValidation = FileValidation2;
|
var streamFile = streamFile2, streamLink = streamLink2, LinkValidation = LinkValidation2, FileValidation = FileValidation2;
|
||||||
const AudioPlayer = createAudioPlayer();
|
const AudioPlayer = createAudioPlayer();
|
||||||
switch (type) {
|
switch (Type) {
|
||||||
case "Link":
|
case "Link":
|
||||||
if (LinkValidation2(Resource) === true && FileValidation2(Resource) === false) {
|
streamLink2(Resource);
|
||||||
streamLink2(Resource);
|
|
||||||
} else {
|
|
||||||
ERR();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "File":
|
case "File":
|
||||||
if (LinkValidation2(Resource) === false && FileValidation2(Resource) === true) {
|
streamFile2(Resource);
|
||||||
streamFile2(Resource);
|
|
||||||
} else {
|
|
||||||
ERR();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "Analyze":
|
case "Analyze":
|
||||||
if (LinkValidation2(Resource) === true && FileValidation2(Resource) === false) {
|
if (LinkValidation2(Resource)) {
|
||||||
streamLink2(Resource);
|
streamLink2(Resource);
|
||||||
} else if (LinkValidation2(Resource) === false && FileValidation2(Resource) === true) {
|
} else if (FileValidation2(Resource)) {
|
||||||
streamFile2(Resource);
|
streamFile2(Resource);
|
||||||
} else {
|
} else {
|
||||||
ERR();
|
ERR();
|
||||||
@@ -99,16 +91,31 @@ function start({
|
|||||||
// src/functions/stopFunc.ts
|
// src/functions/stopFunc.ts
|
||||||
var { getVoiceConnection } = __require("@discordjs/voice");
|
var { getVoiceConnection } = __require("@discordjs/voice");
|
||||||
function stop({
|
function stop({
|
||||||
igi
|
GuildID
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
const connection = getVoiceConnection(igi);
|
const connection = getVoiceConnection(GuildID);
|
||||||
connection.destroy();
|
connection.destroy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
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 {
|
export {
|
||||||
|
setMaxListeners,
|
||||||
start,
|
start,
|
||||||
stop
|
stop
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "discord-audio-stream",
|
"name": "discord-audio-stream",
|
||||||
"version": "0.2.0",
|
"version": "0.3.2",
|
||||||
"description": "🖼️ NPM Package to stream any audio link on discord.",
|
"description": "🖼️ NPM Package to stream any audio link on discord.",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"module": "./dist/index.mjs",
|
"module": "./dist/index.mjs",
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
const { getVoiceConnection } = require("@discordjs/voice");
|
||||||
|
import { ERR, maxListenerParameter } from "../managers/UtilityManager";
|
||||||
|
|
||||||
|
export function setMaxListeners({
|
||||||
|
GuildID,
|
||||||
|
MaxListeners,
|
||||||
|
}: maxListenerParameter) {
|
||||||
|
try {
|
||||||
|
const connection = getVoiceConnection(GuildID);
|
||||||
|
connection.setMaxListeners(MaxListeners);
|
||||||
|
} catch (err) {
|
||||||
|
ERR(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
+22
-30
@@ -1,13 +1,13 @@
|
|||||||
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
|
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
|
||||||
import { ERR, startParameters } from "../managers/UtilityManager";
|
import { ERR, startParameters } from "../managers/UtilityManager";
|
||||||
|
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
|
|
||||||
export function start({
|
export function start({
|
||||||
imvci,
|
VoiceChannelID,
|
||||||
igi,
|
GuildID,
|
||||||
igv,
|
VoiceAdapter,
|
||||||
type,
|
Type,
|
||||||
Resource,
|
Resource,
|
||||||
}: startParameters) {
|
}: startParameters) {
|
||||||
try {
|
try {
|
||||||
@@ -18,9 +18,9 @@ export function start({
|
|||||||
AudioPlayer.play(Audio);
|
AudioPlayer.play(Audio);
|
||||||
|
|
||||||
joinVoiceChannel({
|
joinVoiceChannel({
|
||||||
channelId: imvci,
|
channelId: VoiceChannelID,
|
||||||
guildId: igi,
|
guildId: GuildID,
|
||||||
adapterCreator: igv
|
adapterCreator: VoiceAdapter
|
||||||
}).subscribe(AudioPlayer);
|
}).subscribe(AudioPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,19 +29,19 @@ export function start({
|
|||||||
AudioPlayer.play(Audio);
|
AudioPlayer.play(Audio);
|
||||||
|
|
||||||
joinVoiceChannel({
|
joinVoiceChannel({
|
||||||
channelId: imvci,
|
channelId: VoiceChannelID,
|
||||||
guildId: igi,
|
guildId: GuildID,
|
||||||
adapterCreator: igv
|
adapterCreator: VoiceAdapter
|
||||||
}).subscribe(AudioPlayer)
|
}).subscribe(AudioPlayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
function LinkValidation(URL: string) {
|
function LinkValidation(URL: string) {
|
||||||
var URLPattern = new RegExp('^(https?:\\/\\/)?'+
|
var URLPattern = new RegExp('^(https?:\\/\\/)?' +
|
||||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|'+
|
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.?)+[a-z]{2,}|' +
|
||||||
'((\\d{1,3}\\.){3}\\d{1,3}))'+
|
'((\\d{1,3}\\.){3}\\d{1,3}))' +
|
||||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+
|
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' +
|
||||||
'(\\?[;&a-z\\d%_.~+=-]*)?'+
|
'(\\?[;&a-z\\d%_.~+=-]*)?' +
|
||||||
'(\\#[-a-z\\d_]*)?$','i');
|
'(\\#[-a-z\\d_]*)?$', 'i');
|
||||||
|
|
||||||
return URLPattern.test(URL);
|
return URLPattern.test(URL);
|
||||||
}
|
}
|
||||||
@@ -52,25 +52,17 @@ export function start({
|
|||||||
return FILEPattern.test(FILE);
|
return FILEPattern.test(FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (Type) {
|
||||||
case "Link":
|
case "Link":
|
||||||
if(LinkValidation(Resource) === true && FileValidation(Resource) === false) {
|
streamLink(Resource);
|
||||||
streamLink(Resource);
|
|
||||||
} else {
|
|
||||||
ERR();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "File":
|
case "File":
|
||||||
if(LinkValidation(Resource) === false && FileValidation(Resource) === true) {
|
streamFile(Resource);
|
||||||
streamFile(Resource);
|
|
||||||
} else {
|
|
||||||
ERR();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "Analyze":
|
case "Analyze":
|
||||||
if(LinkValidation(Resource) === true && FileValidation(Resource) === false) {
|
if (LinkValidation(Resource)) {
|
||||||
streamLink(Resource);
|
streamLink(Resource);
|
||||||
} else if(LinkValidation(Resource) === false && FileValidation(Resource) === true) {
|
} else if (FileValidation(Resource)) {
|
||||||
streamFile(Resource)
|
streamFile(Resource)
|
||||||
} else {
|
} else {
|
||||||
ERR();
|
ERR();
|
||||||
|
|||||||
@@ -2,13 +2,12 @@ const { getVoiceConnection } = require("@discordjs/voice");
|
|||||||
import { ERR, stopParameter } from "../managers/UtilityManager";
|
import { ERR, stopParameter } from "../managers/UtilityManager";
|
||||||
|
|
||||||
export function stop({
|
export function stop({
|
||||||
igi,
|
GuildID,
|
||||||
}: stopParameter) {
|
}: stopParameter) {
|
||||||
try {
|
try {
|
||||||
const connection = getVoiceConnection(igi);
|
const connection = getVoiceConnection(GuildID);
|
||||||
|
|
||||||
connection.destroy();
|
connection.destroy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
ERR();
|
ERR(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
export * from "../functions/startFunc";
|
export * from "../functions/startFunc";
|
||||||
export * from "../functions/stopFunc";
|
export * from "../functions/stopFunc";
|
||||||
|
export * from "../functions/maxListenersFunc";
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
export * from "../utility/errorFunc";
|
export * from "../utility/errorFunc";
|
||||||
export * from "../utility/startParameters";
|
export * from "../utility/startParameters";
|
||||||
export * from "../utility/stopParameter";
|
export * from "../utility/stopParameter";
|
||||||
|
export * from "../utility/maxListenerParameter";
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export type maxListenerParameter = {
|
||||||
|
GuildID: number;
|
||||||
|
MaxListeners: number;
|
||||||
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
export type startParameters = {
|
export type startParameters = {
|
||||||
imvci: number;
|
VoiceChannelID: number;
|
||||||
igi: number;
|
GuildID: number;
|
||||||
igv: number;
|
VoiceAdapter: number;
|
||||||
type: string;
|
Type: string;
|
||||||
Resource: string;
|
Resource: string;
|
||||||
};
|
};
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
export type stopParameter = {
|
export type stopParameter = {
|
||||||
igi: number;
|
GuildID: number;
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user