Add files via upload
This commit is contained in:
@@ -17,13 +17,13 @@ Pease create a bug post on github or write [`fraujulian`](https://discord.com/us
|
||||
## 📝 Usage
|
||||
|
||||
### Install package
|
||||
```
|
||||
```bash
|
||||
npm i discord-audio-stream
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
```bash
|
||||
yarn add discord-audio-stream
|
||||
```
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ type StopProps = {
|
||||
igi: number;
|
||||
};
|
||||
|
||||
declare function StreamStart({ imvci, igi, igv, type, Resource, }: StartProps): void;
|
||||
declare function StreamStart({ imvci, igi, igv, type, Resource, }: StartProps): "Unknown" | undefined;
|
||||
|
||||
declare function StreamStop({ igi, }: StopProps): void;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ type StopProps = {
|
||||
igi: number;
|
||||
};
|
||||
|
||||
declare function StreamStart({ imvci, igi, igv, type, Resource, }: StartProps): void;
|
||||
declare function StreamStart({ imvci, igi, igv, type, Resource, }: StartProps): "Unknown" | undefined;
|
||||
|
||||
declare function StreamStop({ igi, }: StopProps): void;
|
||||
|
||||
|
||||
Vendored
+5
-34
@@ -38,8 +38,7 @@ function ERROR() {
|
||||
}
|
||||
|
||||
// src/functions/start.ts
|
||||
var import_node_path = require("path");
|
||||
var Source = "";
|
||||
var import_path = require("path");
|
||||
var { joinVoiceChannel, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
|
||||
function StreamStart({
|
||||
imvci,
|
||||
@@ -50,7 +49,7 @@ function StreamStart({
|
||||
}) {
|
||||
try {
|
||||
let FileResource2 = function() {
|
||||
let Audio = createAudioResource((0, import_node_path.join)(__dirname, Source));
|
||||
let Audio = createAudioResource((0, import_path.join)(__dirname, Resource), { inlineVolume: true });
|
||||
AudioPlayer.play(Audio);
|
||||
joinVoiceChannel({
|
||||
//Join the channel.
|
||||
@@ -74,67 +73,39 @@ function StreamStart({
|
||||
if (type === "Link") {
|
||||
if (URLPattern.test(Resource) === true) {
|
||||
LinkResource2();
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Play");
|
||||
});
|
||||
} else {
|
||||
ERROR();
|
||||
console.log("CODE: Resource isn't a Link!");
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Unknown");
|
||||
});
|
||||
}
|
||||
} else if (type === "File") {
|
||||
if (Resource.startsWith(".") == true) {
|
||||
Source = require(Resource);
|
||||
if (Resource.startsWith("join(") == true) {
|
||||
FileResource2();
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Play");
|
||||
});
|
||||
} else {
|
||||
ERROR();
|
||||
console.log("CODE: Resource isn't a File!");
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Unknown");
|
||||
});
|
||||
}
|
||||
} else if (type === "Analyze") {
|
||||
if (Resource.startsWith(".") == true) {
|
||||
Source = require(Resource);
|
||||
if (Resource.startsWith("join(") == true) {
|
||||
FileResource2();
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Play");
|
||||
});
|
||||
} else if (URLPattern.test(Resource) === true) {
|
||||
LinkResource2();
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Play");
|
||||
});
|
||||
} else {
|
||||
ERROR();
|
||||
console.log("CODE: Resource isn't a Link or a File!");
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Unknown");
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ERROR();
|
||||
console.log("CODE: Unknown resource type!");
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Unknown");
|
||||
});
|
||||
return "Unknown";
|
||||
}
|
||||
} catch (error) {
|
||||
ERROR();
|
||||
console.log(">> ERR:\n" + error);
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("ERROR");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+5
-34
@@ -26,8 +26,7 @@ function ERROR() {
|
||||
}
|
||||
|
||||
// src/functions/start.ts
|
||||
import { join } from "node:path";
|
||||
var Source = "";
|
||||
import { join } from "path";
|
||||
var { joinVoiceChannel, createAudioPlayer, createAudioResource } = __require("@discordjs/voice");
|
||||
function StreamStart({
|
||||
imvci,
|
||||
@@ -38,7 +37,7 @@ function StreamStart({
|
||||
}) {
|
||||
try {
|
||||
let FileResource2 = function() {
|
||||
let Audio = createAudioResource(join(__dirname, Source));
|
||||
let Audio = createAudioResource(join(__dirname, Resource), { inlineVolume: true });
|
||||
AudioPlayer.play(Audio);
|
||||
joinVoiceChannel({
|
||||
//Join the channel.
|
||||
@@ -62,67 +61,39 @@ function StreamStart({
|
||||
if (type === "Link") {
|
||||
if (URLPattern.test(Resource) === true) {
|
||||
LinkResource2();
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Play");
|
||||
});
|
||||
} else {
|
||||
ERROR();
|
||||
console.log("CODE: Resource isn't a Link!");
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Unknown");
|
||||
});
|
||||
}
|
||||
} else if (type === "File") {
|
||||
if (Resource.startsWith(".") == true) {
|
||||
Source = __require(Resource);
|
||||
if (Resource.startsWith("join(") == true) {
|
||||
FileResource2();
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Play");
|
||||
});
|
||||
} else {
|
||||
ERROR();
|
||||
console.log("CODE: Resource isn't a File!");
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Unknown");
|
||||
});
|
||||
}
|
||||
} else if (type === "Analyze") {
|
||||
if (Resource.startsWith(".") == true) {
|
||||
Source = __require(Resource);
|
||||
if (Resource.startsWith("join(") == true) {
|
||||
FileResource2();
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Play");
|
||||
});
|
||||
} else if (URLPattern.test(Resource) === true) {
|
||||
LinkResource2();
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Play");
|
||||
});
|
||||
} else {
|
||||
ERROR();
|
||||
console.log("CODE: Resource isn't a Link or a File!");
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Unknown");
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ERROR();
|
||||
console.log("CODE: Unknown resource type!");
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("Unknown");
|
||||
});
|
||||
return "Unknown";
|
||||
}
|
||||
} catch (error) {
|
||||
ERROR();
|
||||
console.log(">> ERR:\n" + error);
|
||||
console.log(" ");
|
||||
const result = new Promise((resolve2, reject) => {
|
||||
resolve2("ERROR");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Generated
-234
@@ -10,7 +10,6 @@
|
||||
"license": "BSD-3-Clause",
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.16.1",
|
||||
"discord.js": "^14.14.1",
|
||||
"ffmpeg-static": "^5.2.0",
|
||||
"fs": "^0.0.1-security",
|
||||
"libsodium-wrappers": "^0.7.13",
|
||||
@@ -37,77 +36,6 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/builders": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-1.7.0.tgz",
|
||||
"integrity": "sha512-GDtbKMkg433cOZur8Dv6c25EHxduNIBsxeHrsRoIM8+AwmEZ8r0tEpckx/sHwTLwQPOF3e2JWloZh9ofCaMfAw==",
|
||||
"dependencies": {
|
||||
"@discordjs/formatters": "^0.3.3",
|
||||
"@discordjs/util": "^1.0.2",
|
||||
"@sapphire/shapeshift": "^3.9.3",
|
||||
"discord-api-types": "0.37.61",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"ts-mixer": "^6.0.3",
|
||||
"tslib": "^2.6.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/collection": {
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-1.5.3.tgz",
|
||||
"integrity": "sha512-SVb428OMd3WO1paV3rm6tSjM4wC+Kecaa1EUGX7vc6/fddvw/6lg90z4QtCqm21zvVe92vMMDt9+DkIvjXImQQ==",
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/formatters": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/formatters/-/formatters-0.3.3.tgz",
|
||||
"integrity": "sha512-wTcI1Q5cps1eSGhl6+6AzzZkBBlVrBdc9IUhJbijRgVjCNIIIZPgqnUj3ntFODsHrdbGU8BEG9XmDQmgEEYn3w==",
|
||||
"dependencies": {
|
||||
"discord-api-types": "0.37.61"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/rest": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-2.2.0.tgz",
|
||||
"integrity": "sha512-nXm9wT8oqrYFRMEqTXQx9DUTeEtXUDMmnUKIhZn6O2EeDY9VCdwj23XCPq7fkqMPKdF7ldAfeVKyxxFdbZl59A==",
|
||||
"dependencies": {
|
||||
"@discordjs/collection": "^2.0.0",
|
||||
"@discordjs/util": "^1.0.2",
|
||||
"@sapphire/async-queue": "^1.5.0",
|
||||
"@sapphire/snowflake": "^3.5.1",
|
||||
"@vladfrangu/async_event_emitter": "^2.2.2",
|
||||
"discord-api-types": "0.37.61",
|
||||
"magic-bytes.js": "^1.5.0",
|
||||
"tslib": "^2.6.2",
|
||||
"undici": "5.27.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/rest/node_modules/@discordjs/collection": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.0.0.tgz",
|
||||
"integrity": "sha512-YTWIXLrf5FsrLMycpMM9Q6vnZoR/lN2AWX23/Cuo8uOOtS8eHB2dyQaaGnaF8aZPYnttf2bkLMcXn/j6JUOi3w==",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/util": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/util/-/util-1.0.2.tgz",
|
||||
"integrity": "sha512-IRNbimrmfb75GMNEjyznqM1tkI7HrZOf14njX7tCAAUetyZM1Pr8hX/EK2lxBCOgWDRmigbp24fD1hdMfQK5lw==",
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/voice": {
|
||||
"version": "0.16.1",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/voice/-/voice-0.16.1.tgz",
|
||||
@@ -123,33 +51,6 @@
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/ws": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/ws/-/ws-1.0.2.tgz",
|
||||
"integrity": "sha512-+XI82Rm2hKnFwAySXEep4A7Kfoowt6weO6381jgW+wVdTpMS/56qCvoXyFRY0slcv7c/U8My2PwIB2/wEaAh7Q==",
|
||||
"dependencies": {
|
||||
"@discordjs/collection": "^2.0.0",
|
||||
"@discordjs/rest": "^2.1.0",
|
||||
"@discordjs/util": "^1.0.2",
|
||||
"@sapphire/async-queue": "^1.5.0",
|
||||
"@types/ws": "^8.5.9",
|
||||
"@vladfrangu/async_event_emitter": "^2.2.2",
|
||||
"discord-api-types": "0.37.61",
|
||||
"tslib": "^2.6.2",
|
||||
"ws": "^8.14.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@discordjs/ws/node_modules/@discordjs/collection": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-2.0.0.tgz",
|
||||
"integrity": "sha512-YTWIXLrf5FsrLMycpMM9Q6vnZoR/lN2AWX23/Cuo8uOOtS8eHB2dyQaaGnaF8aZPYnttf2bkLMcXn/j6JUOi3w==",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.19.12",
|
||||
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz",
|
||||
@@ -518,14 +419,6 @@
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/@fastify/busboy": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
|
||||
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@isaacs/cliui": {
|
||||
"version": "8.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
|
||||
@@ -844,36 +737,6 @@
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@sapphire/async-queue": {
|
||||
"version": "1.5.2",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.2.tgz",
|
||||
"integrity": "sha512-7X7FFAA4DngXUl95+hYbUF19bp1LGiffjJtu7ygrZrbdCSsdDDBaSjB7Akw0ZbOu6k0xpXyljnJ6/RZUvLfRdg==",
|
||||
"engines": {
|
||||
"node": ">=v14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sapphire/shapeshift": {
|
||||
"version": "3.9.7",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/shapeshift/-/shapeshift-3.9.7.tgz",
|
||||
"integrity": "sha512-4It2mxPSr4OGn4HSQWGmhFMsNFGfFVhWeRPCRwbH972Ek2pzfGRZtb0pJ4Ze6oIzcyh2jw7nUDa6qGlWofgd9g==",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"lodash": "^4.17.21"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=v16"
|
||||
}
|
||||
},
|
||||
"node_modules/@sapphire/snowflake": {
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.5.1.tgz",
|
||||
"integrity": "sha512-BxcYGzgEsdlG0dKAyOm0ehLGm2CafIrfQTZGWgkfKYbj+pNNsorZ7EotuZukc2MT70E0UbppVbtpBrqpzVzjNA==",
|
||||
"engines": {
|
||||
"node": ">=v14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/ejs": {
|
||||
"version": "3.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/ejs/-/ejs-3.1.5.tgz",
|
||||
@@ -902,15 +765,6 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@vladfrangu/async_event_emitter": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@vladfrangu/async_event_emitter/-/async_event_emitter-2.2.4.tgz",
|
||||
"integrity": "sha512-ButUPz9E9cXMLgvAW8aLAKKJJsPu1dY1/l/E8xzLFuysowXygs6GBcyunK9rnGC4zTsnIc2mQo71rGw9U+Ykug==",
|
||||
"engines": {
|
||||
"node": ">=v14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
@@ -1159,58 +1013,6 @@
|
||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.37.61.tgz",
|
||||
"integrity": "sha512-o/dXNFfhBpYHpQFdT6FWzeO7pKc838QeeZ9d91CfVAtpr5XLK4B/zYxQbYgPdoMiTDvJfzcsLW5naXgmHGDNXw=="
|
||||
},
|
||||
"node_modules/discord.js": {
|
||||
"version": "14.14.1",
|
||||
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-14.14.1.tgz",
|
||||
"integrity": "sha512-/hUVzkIerxKHyRKopJy5xejp4MYKDPTszAnpYxzVVv4qJYf+Tkt+jnT2N29PIPschicaEEpXwF2ARrTYHYwQ5w==",
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^1.7.0",
|
||||
"@discordjs/collection": "1.5.3",
|
||||
"@discordjs/formatters": "^0.3.3",
|
||||
"@discordjs/rest": "^2.1.0",
|
||||
"@discordjs/util": "^1.0.2",
|
||||
"@discordjs/ws": "^1.0.2",
|
||||
"@sapphire/snowflake": "3.5.1",
|
||||
"@types/ws": "8.5.9",
|
||||
"discord-api-types": "0.37.61",
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"lodash.snakecase": "4.1.1",
|
||||
"tslib": "2.6.2",
|
||||
"undici": "5.27.2",
|
||||
"ws": "8.14.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/discord.js/node_modules/@types/ws": {
|
||||
"version": "8.5.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.9.tgz",
|
||||
"integrity": "sha512-jbdrY0a8lxfdTp/+r7Z4CkycbOFN8WX+IOchLJr3juT/xzbJ8URyTVSJ/hvNdadTgM1mnedb47n+Y31GsFnQlg==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/discord.js/node_modules/ws": {
|
||||
"version": "8.14.2",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.14.2.tgz",
|
||||
"integrity": "sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eastasianwidth": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||
@@ -1292,11 +1094,6 @@
|
||||
"url": "https://github.com/sindresorhus/execa?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
},
|
||||
"node_modules/fast-glob": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
|
||||
@@ -1646,16 +1443,6 @@
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/lodash.snakecase": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz",
|
||||
"integrity": "sha512-QZ1d4xoBHYUeuouhEq3lk3Uq7ldgyFXGBhg04+oRLnIz8o9T65Eh+8YdroUwn846zchkA9yDsDl5CVVaV2nqYw=="
|
||||
},
|
||||
"node_modules/lodash.sortby": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
|
||||
@@ -1671,11 +1458,6 @@
|
||||
"node": "14 || >=16.14"
|
||||
}
|
||||
},
|
||||
"node_modules/magic-bytes.js": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.10.0.tgz",
|
||||
"integrity": "sha512-/k20Lg2q8LE5xiaaSkMXk4sfvI+9EGEykFS4b0CHHGWqDYU0bGUFSwchNOMA56D7TCs9GwVTkqe9als1/ns8UQ=="
|
||||
},
|
||||
"node_modules/merge-stream": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||
@@ -2321,11 +2103,6 @@
|
||||
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/ts-mixer": {
|
||||
"version": "6.0.4",
|
||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz",
|
||||
"integrity": "sha512-ufKpbmrugz5Aou4wcr5Wc1UUFWOLhq+Fm6qa6P0w0K5Qw2yhaUoiWszhCVuNQyNwrlGiscHOmqYoAox1PtvgjA=="
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.6.2",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
|
||||
@@ -2398,17 +2175,6 @@
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici": {
|
||||
"version": "5.27.2",
|
||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.27.2.tgz",
|
||||
"integrity": "sha512-iS857PdOEy/y3wlM3yRp+6SNQQ6xU0mmZcwRSriqk+et/cwWAtwmIGf6WkoDN2EK/AMdCO/dfXzIwi+rFMrjjQ==",
|
||||
"dependencies": {
|
||||
"@fastify/busboy": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "5.26.5",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord-audio-stream",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "🖼️ NPM Package to stream any audio link on discord.",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.mjs",
|
||||
@@ -32,7 +32,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.16.1",
|
||||
"discord.js": "^14.14.1",
|
||||
"ffmpeg-static": "^5.2.0",
|
||||
"fs": "^0.0.1-security",
|
||||
"libsodium-wrappers": "^0.7.13",
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { StartProps } from "../stuff/types";
|
||||
import { ERROR } from "../stuff/error";
|
||||
|
||||
import { join } from "node:path";
|
||||
|
||||
let Source = "";
|
||||
import { join } from "path";
|
||||
|
||||
const { joinVoiceChannel, createAudioPlayer, createAudioResource } = require("@discordjs/voice");
|
||||
|
||||
@@ -20,8 +18,8 @@ export function StreamStart({
|
||||
|
||||
//Play function for file resource.
|
||||
function FileResource() {
|
||||
|
||||
let Audio = createAudioResource(join(__dirname, Source)); //Fetch stream File.
|
||||
|
||||
let Audio = createAudioResource(join(__dirname, Resource), { inlineVolume: true }); //Fetch stream File.
|
||||
AudioPlayer.play(Audio); //Set AudioPlayer to resource File.
|
||||
|
||||
joinVoiceChannel({ //Join the channel.
|
||||
@@ -64,9 +62,8 @@ export function StreamStart({
|
||||
}
|
||||
|
||||
} else if (type === "File") { //If the type is "File".
|
||||
if (Resource.startsWith(".") == true) { //Check if the resource file exist.
|
||||
if (Resource.startsWith("join(") == true) { //Check if the resource file exist.
|
||||
|
||||
Source = require(Resource); //Set Source variable to Audio File.
|
||||
FileResource(); //Run FileResource function.
|
||||
|
||||
} else { //If resource is not a file.
|
||||
@@ -77,9 +74,8 @@ export function StreamStart({
|
||||
|
||||
} else if (type === "Analyze") { //If the type is "Analyze".
|
||||
|
||||
if (Resource.startsWith(".") == true) { //Check if the resource file exist.
|
||||
if (Resource.startsWith("join(") == true) { //Check if the resource file exist.
|
||||
|
||||
Source = require(Resource); //Set Source variable to Audio File.
|
||||
FileResource(); //Run FileResource function.
|
||||
|
||||
} else if (URLPattern.test(Resource) === true) { //Check if Link is a URL.
|
||||
@@ -96,6 +92,7 @@ export function StreamStart({
|
||||
ERROR(); //Run ERROR function.
|
||||
console.log("CODE: Unknown resource type!") //"Error Code" usefull for help people.
|
||||
console.log(" ") //Placeholder xD
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
} catch (error) { //If syntax is wrong.
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
"moduleResolution": "Node",
|
||||
"module": "CommonJS",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"jsx": "react",
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"outDir": "dist",
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import { defineConfig } from "tsup";
|
||||
|
||||
export default defineConfig({
|
||||
format: ['cjs', 'esm'],
|
||||
entry: ['./src/index.ts'],
|
||||
format: [ "cjs", "esm" ],
|
||||
entry: ["./src/index.ts"],
|
||||
dts: true,
|
||||
shims: true,
|
||||
skipNodeModulesBundle: true,
|
||||
|
||||
Reference in New Issue
Block a user