Skip to content

Commit

Permalink
bot: 3.4.0
Browse files Browse the repository at this point in the history
* Pull in latest core changes from my private bots
* Package updates
* Small change to pruning, now it is toggable on a per-queue basis
  • Loading branch information
nikosszzz authored Sep 18, 2024
1 parent c9d5f23 commit e0e7cae
Show file tree
Hide file tree
Showing 39 changed files with 521 additions and 772 deletions.
6 changes: 6 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
TOKEN=TOKEN_HERE
DEVTOKEN=DEV_TOKEN_HERE
SOUNDCLOUD_CLIENT_ID=CLIENT_ID_HERE
SPOTIFY_SECRET_ID=SECRET_ID_HERE
SPOTIFY_CLIENT_ID=CLIENT_ID_HERE
SPOTIFY_REFRESH_TOKEN=REFRESH_TOKEN_HERE
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@

- Install latest Node.JS LTS and Git.
- Install the bot's dependencies (pnpm, npm or whatever you use).
- Modify the `Bot.ts` and `config.ts` files in `./src/components/` for your bot's configuration.
- Modify the `Bot.ts`files in `./src/components/` for your bot's configuration.
- Either make a `.env` file based off the config in `.env-example` or configure the `config.ts` in `./src/components/` for your bot.
- Run the `build` script.
- Run the `bundle.js` output file in the `dist` folder.
- Run the `bundle.js` output file in the `dist` folder or the `start` script.

## 🛠️ Contributions

Expand Down
51 changes: 51 additions & 0 deletions build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { execSync } from "child_process";
import { version } from "typescript"
import { buildSync } from "esbuild";

function hash() {
try {
return execSync("git rev-parse --short HEAD").toString().trim();
} catch (e) {
return "null";
}
}

try {
console.log("Building Music Bot...");

buildSync({
entryPoints: ["src/index.ts"],
bundle: true,
packages: "external",
platform: "node",
target: "node22",
format: "esm",
minify: true,
minifyIdentifiers: true,
minifySyntax: true,
minifyWhitespace: true,
mangleQuoted: true,
ignoreAnnotations: true,
treeShaking: true,
outfile: "dist/bundle.js",
define: {
__VERSION__: `"${hash()}"`,
__TYPESCRIPTVERSION__: `"${version}"`
},
});

console.log("Successfully built Music Bot!");
} catch (err) {
console.error(`Failed to build Music Bot:\n ${err}`);
process.exit(1);
}


if (process.argv.includes("--run")) {
console.log("Running Music Bot bundle...");
try {
execSync("node ./dist/bundle.js", { stdio: "inherit" });
} catch (_x) {
console.log("Music Bot closed.");
}
}
23 changes: 9 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "music-bot",
"version": "3.3.2",
"version": "3.4.0",
"description": "A general music Discord bot.",
"main": "./src/bot.ts",
"type": "module",
Expand All @@ -22,30 +22,25 @@
"array-move": "^4.0.0",
"bufferutil": "^4.0.8",
"chalk": "^5.3.0",
"discord.js": "^14.15.2",
"discord.js": "^14.16.2",
"dotenv": "^16.4.5",
"ffmpeg-static": "^5.2.0",
"opusscript": "^0.1.1",
"play-dl": "^1.9.7",
"sodium-native": "^4.1.1",
"sodium-native": "^4.2.0",
"string-progressbar": "^1.0.4",
"utf-8-validate": "^6.0.4"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^20.12.12",
"esbuild": "^0.21.3",
"rollup": "^4.18.0",
"rollup-plugin-esbuild": "^6.1.1",
"rollup-plugin-typescript-paths": "^1.5.0",
"tslib": "^2.6.2",
"typescript": "^5.4.5"
"@types/node": "^20.16.5",
"esbuild": "^0.23.1",
"typescript": "^5.6.2"
},
"scripts": {
"start": "node ./dist/bundle.js",
"startb": "rollup -c --configPlugin @rollup/plugin-typescript && node ./dist/bundle.js",
"dev": "node build.mjs --run",
"lint": "eslint . --fix",
"build": "rollup -c --configPlugin @rollup/plugin-typescript"
"build": "node build.mjs"
},
"keywords": [],
"license": "GPL-3.0"
}
Loading

0 comments on commit e0e7cae

Please sign in to comment.