Skip to content

Commit

Permalink
bot: 3.3.0
Browse files Browse the repository at this point in the history
* ESM 🎉
  • Loading branch information
nikosszzz committed May 23, 2024
1 parent 2203272 commit 421d6f7
Show file tree
Hide file tree
Showing 37 changed files with 300 additions and 337 deletions.
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "music-bot",
"version": "3.2.1",
"version": "3.3.0",
"description": "A general music Discord bot.",
"main": "./src/bot.ts",
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/nikosszzz/musicbot.git"
Expand All @@ -17,23 +18,23 @@
},
"dependencies": {
"@discordjs/voice": "^0.17.0",
"array-move": "^3.0.1",
"array-move": "^4.0.0",
"bufferutil": "^4.0.8",
"chalk": "^4.1.2",
"chalk": "^5.3.0",
"discord.js": "^14.15.2",
"ffmpeg-static": "^5.2.0",
"lyrics-finder": "^21.7.0",
"opusscript": "^0.1.1",
"play-dl": "^1.9.7",
"sodium-native": "^4.1.1",
"string-progressbar": "^1.0.4",
"utf-8-validate": "^6.0.3"
"utf-8-validate": "^6.0.4"
},
"devDependencies": {
"@rollup/plugin-typescript": "^11.1.6",
"@types/node": "^20.12.11",
"esbuild": "^0.21.1",
"rollup": "^4.17.2",
"@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",
Expand Down
458 changes: 210 additions & 248 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions rollup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from "rollup";
import { typescriptPaths as paths } from "rollup-plugin-typescript-paths";
import { typescriptPaths } from "rollup-plugin-typescript-paths";
import { execSync } from "node:child_process";
import version from "typescript";
import ts from "typescript";
import esbuild from 'rollup-plugin-esbuild';

function hash(): string {
Expand All @@ -24,12 +24,12 @@ export default defineConfig([{
inlineDynamicImports: true,
minifyInternalExports: true,
compact: true,
format: "cjs",
format: "esm",
strict: true,
sourcemap: false,
},
plugins: [
paths({ preserveExtensions: true, nonRelative: true }),
typescriptPaths({ preserveExtensions: true, nonRelative: true }),
esbuild({
platform: "node",
target: "esnext",
Expand All @@ -41,7 +41,7 @@ export default defineConfig([{
ignoreAnnotations: true,
define: {
__VERSION__: `"${hash()}"`,
__TYPESCRIPTVERSION__: `"${version.version}"`
__TYPESCRIPTVERSION__: `"${ts.version}"`
},
treeShaking: true
})
Expand Down
8 changes: 4 additions & 4 deletions src/commands/info/changelogs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Command } from "@common/types";
import type { Command } from "@common";
import { EmbedBuilder, SlashCommandBuilder } from "discord.js";

export default {
Expand All @@ -7,10 +7,10 @@ export default {
.setDescription("Displays information about the latest Music Bot update."),
async execute(interaction) {

const bugfixes = `- queue: Fix double \`Queue ended.\` message from the /stop command
- queue: Fix an issue where the \`Loading...\` message was not edited to the Now Playing embed.`;
const bugfixes = `- None`;

const whatsnew = `- bot: Updated and upgraded`;
const whatsnew = `- bot: Updated and upgraded
- codebase: Update to ESM format`;

const UpdateEmbed = new EmbedBuilder()
.setColor("NotQuiteBlack")
Expand Down
8 changes: 4 additions & 4 deletions src/commands/info/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import changelogs from "./changelogs";
import info from "./info";
import membercount from "./membercount";
import ping from "./ping";
import changelogs from "./changelogs.js";
import info from "./info.js";
import membercount from "./membercount.js";
import ping from "./ping.js";

export const commands = [
changelogs,
Expand Down
5 changes: 2 additions & 3 deletions src/commands/info/info.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { EmbedBuilder, SlashCommandBuilder, version as djsVersion } from "discord.js";
import { Logger } from "@components/Logger";
import { timeConverter } from "@utils/timeConverter";
import { hash } from "@utils/hash";
import type { Command } from "@common/types";
import { timeConverter, hash } from "@utils";
import type { Command } from "@common";
import { version } from "node:process";

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/membercount.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Command } from "@common/types";
import type { Command } from "@common";
import { EmbedBuilder, SlashCommandBuilder } from "discord.js";

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/ping.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { Logger } from "@components/Logger";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
32 changes: 16 additions & 16 deletions src/commands/music/index.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import loop from "./loop";
import lyrics from "./lyrics";
import move from "./move";
import nowplaying from "./nowplaying";
import pause from "./pause";
import play from "./play";
import playlist from "./playlist";
import pruning from "./pruning";
import queue from "./queue";
import remove from "./remove";
import resume from "./resume";
import shuffle from "./shuffle";
import skip from "./skip";
import skipto from "./skipto";
import stop from "./stop";
import volume from "./volume";
import loop from "./loop.js";
import lyrics from "./lyrics.js";
import move from "./move.js";
import nowplaying from "./nowplaying.js";
import pause from "./pause.js";
import play from "./play.js";
import playlist from "./playlist.js";
import pruning from "./pruning.js";
import queue from "./queue.js";
import remove from "./remove.js";
import resume from "./resume.js";
import shuffle from "./shuffle.js";
import skip from "./skip.js";
import skipto from "./skipto.js";
import stop from "./stop.js";
import volume from "./volume.js";

export const commands = [
loop,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/loop.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EmbedBuilder, type GuildMember, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/lyrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
// @ts-ignore
import lyricsFinder from "lyrics-finder";
import { Logger } from "@components/Logger";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
6 changes: 3 additions & 3 deletions src/commands/music/move.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type GuildMember, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import move from "array-move";
import type { Command } from "@common/types";
import { arrayMoveImmutable } from "array-move";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down Expand Up @@ -39,7 +39,7 @@ export default {
if (firstPos <= 1) return interaction.reply({ content: "Provide valid position numbers.", ephemeral: true });

const song = queue.songs[firstPos - 1];
queue.songs = move(queue.songs, firstPos - 1, secondPos == 1 ? 1 : secondPos - 1);
queue.songs = arrayMoveImmutable(queue.songs, firstPos - 1, secondPos == 1 ? 1 : secondPos - 1);

const moveEmbed = new EmbedBuilder()
.setColor("NotQuiteBlack")
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/nowplaying.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { splitBar } from "string-progressbar";
import { Logger } from "@components/Logger";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/pause.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type GuildMember, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/play.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MusicQueue } from "@components/MusicQueue";
import { Song } from "@components/Song";
import { Logger } from "@components/Logger";
import { sp_validate, so_validate, yt_validate } from "play-dl";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/playlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type GuildMember, EmbedBuilder, SlashCommandBuilder, PermissionFlagsBit
import { Logger } from "@components/Logger";
import { MusicQueue } from "@components/MusicQueue";
import { Playlist } from "@components/Playlist";
import type { Command } from "@common/types";
import type { Command } from "@common";
import { SoundCloudPlaylist, SpotifyPlaylist } from "play-dl";

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/pruning.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
import type { Command } from "@common/types";
import type { Command } from "@common";
import { config } from "@components/config";

export default {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/queue.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EmbedBuilder, ActionRowBuilder, ButtonBuilder, SlashCommandBuilder, ButtonStyle, type CollectedInteraction, type CacheType, type ChatInputCommandInteraction } from "discord.js";
import { Logger } from "@components/Logger";
import type { Song } from "@components/Song";
import type { Command } from "@common/types";
import type { Command } from "@common";

let currentPage: number = 0 as number;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/remove.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EmbedBuilder, type GuildMember, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/resume.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EmbedBuilder, type GuildMember, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/shuffle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EmbedBuilder, type GuildMember, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/skip.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type GuildMember, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/skipto.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type GuildMember, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Song } from "@components/Song";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/stop.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type GuildMember, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/music/volume.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type GuildMember, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { canModifyQueue } from "@components/QueueUtils";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
4 changes: 2 additions & 2 deletions src/commands/utility/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import serverinfo from "./serverinfo";
import userinfo from "./userinfo";
import serverinfo from "./serverinfo.js";
import userinfo from "./userinfo.js";

export const commands = [
serverinfo,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/utility/serverinfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChannelType, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { Logger } from "@components/Logger";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/commands/utility/userinfo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EmbedBuilder, SlashCommandBuilder, PermissionFlagsBits, type GuildMember } from "discord.js";
import { Logger } from "@components/Logger";
import type { Command } from "@common/types";
import type { Command } from "@common";

export default {
data: new SlashCommandBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/common/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./types";
export * from "./types.js";
2 changes: 0 additions & 2 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,3 @@ export type QueueOptions = {
connection: VoiceConnection;
interaction: ChatInputCommandInteraction<CacheType>;
}

export { };
2 changes: 1 addition & 1 deletion src/components/Bot.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Client, type ClientOptions, Collection } from "discord.js";
import type { Command } from "@common/types";
import type { Command } from "@common";
import { config } from "@components/config";
import { Manager } from "@manager";
import type { MusicQueue } from "@components/MusicQueue";
Expand Down
2 changes: 1 addition & 1 deletion src/components/MusicQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "@discordjs/voice";
import type { CacheType, ChatInputCommandInteraction, Message, TextChannel } from "discord.js";
import { promisify } from "node:util";
import type { QueueOptions } from "common";
import type { QueueOptions } from "@common";
import { config } from "@components/config";
import type { Song } from "@components/Song";
import type { Bot } from "@components/Bot";
Expand Down
2 changes: 1 addition & 1 deletion src/components/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config } from "@common/types";
import { Config } from "@common";

export const config: Config = {
TOKEN: process.env.TOKEN || "",
Expand Down
4 changes: 2 additions & 2 deletions src/manager/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ready } from "./modules/ready";
import { commands } from "./modules/commands";
import { ready } from "./modules/ready.js";
import { commands } from "./modules/commands.js";
import { Logger } from "@components/Logger";
import type { Bot } from "@components/Bot";

Expand Down
Loading

0 comments on commit 421d6f7

Please sign in to comment.