Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb52ee1b59 | ||
|
|
6a3245f8de |
No files matched your search
@@ -1 +1,2 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
Procfile
|
||||||
+29
-30
@@ -6,47 +6,46 @@ name: CI/CD
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- "*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [16.x]
|
node-version: [18.x]
|
||||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
cache: "npm"
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build --if-present
|
- run: npm run build --if-present
|
||||||
|
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
- name: Log in to Docker Hub
|
||||||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||||
with:
|
with:
|
||||||
images: unknowableshade/quetza-bot
|
images: unknowableshade/quetza-bot
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
+6
-6
@@ -1,9 +1,10 @@
|
|||||||
FROM node:16
|
FROM node:18-alpine
|
||||||
|
|
||||||
RUN apt -y update
|
|
||||||
RUN apt install -y ffmpeg
|
|
||||||
RUN apt install -y python3-pip
|
|
||||||
|
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add --no-cache bash
|
||||||
|
RUN apk add --no-cache curl
|
||||||
|
RUN apk add --no-cache ffmpeg
|
||||||
|
RUN apk add --no-cache python3
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
@@ -11,7 +12,6 @@ RUN mkdir bin
|
|||||||
RUN curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/src/app/bin/youtube-dl
|
RUN curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/src/app/bin/youtube-dl
|
||||||
RUN chmod a+rx /usr/src/app/bin/youtube-dl
|
RUN chmod a+rx /usr/src/app/bin/youtube-dl
|
||||||
|
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
# Quetza - 2210.1 <soundrewrite>
|
# Quetza - 2302.1 <soundrewrite>
|
||||||
|
|
||||||
_Neat typescript discord bot._
|
_Neat typescript discord bot._
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
- Base player features.
|
- Base player features.
|
||||||
- Play music from YouTube and many other sites.
|
- Play music from YouTube and many other sites.
|
||||||
- Lots of different filters _(nightcore, earrape etc.)_.
|
- Lots of different filters _(nightcore, earrape etc.)_.
|
||||||
- Slash commands.
|
- Slash commands.
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
- **[Dependencies](https://github.com/unknowableshade/quetza-bot/blob/master/package.json)**
|
- **[Dependencies](https://github.com/unknowableshade/quetza-bot/blob/master/package.json)**
|
||||||
- **[Docker](https://hub.docker.com/repository/docker/unknowableshade/quetza-bot)**
|
- **[Docker](https://hub.docker.com/repository/docker/unknowableshade/quetza-bot)**
|
||||||
- **[Licence](https://github.com/unknowableshade/5a0b-bot/blob/master/LICENSE)**
|
- **[Licence](https://github.com/unknowableshade/5a0b-bot/blob/master/LICENSE)**
|
||||||
Generated
+2396
-3976
File diff suppressed because it is too large.
Load diff
+44
-42
@@ -1,44 +1,46 @@
|
|||||||
{
|
{
|
||||||
"name": "quetza-bot",
|
"name": "quetza-bot",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "16.x.x",
|
"node": "18.x.x",
|
||||||
"npm": "*"
|
"npm": "*"
|
||||||
},
|
},
|
||||||
"version": "2205.3.0",
|
"type": "module",
|
||||||
"description": "Discord multifunctional bot",
|
"version": "2302.1.0",
|
||||||
"author": {
|
"description": "Discord multifunctional bot",
|
||||||
"name": "unknowableshade",
|
"author": {
|
||||||
"email": "60275123+unknowableshade@users.noreply.github.com",
|
"name": "unknowableshade",
|
||||||
"url": "https://unknowableshade.ru"
|
"email": "60275123+unknowableshade@users.noreply.github.com",
|
||||||
},
|
"url": "https://unknowableshade.ru"
|
||||||
"repository": {
|
},
|
||||||
"type": "git",
|
"repository": {
|
||||||
"url": "git+https://github.com/unknowableshade/quetza-bot.git"
|
"type": "git",
|
||||||
},
|
"url": "git+https://github.com/unknowableshade/quetza-bot.git"
|
||||||
"bugs": {
|
},
|
||||||
"url": "https://github.com/unknowableshade/quetza-bot/issues"
|
"bugs": {
|
||||||
},
|
"url": "https://github.com/unknowableshade/quetza-bot/issues"
|
||||||
"readme": "https://github.com/unknowableshade/quetza-bot#readme",
|
},
|
||||||
"license": "MIT",
|
"readme": "https://github.com/unknowableshade/quetza-bot#readme",
|
||||||
"main": "dist/index.js",
|
"license": "MIT",
|
||||||
"scripts": {
|
"main": "dist/index.js",
|
||||||
"start": "node dist/index.js",
|
"scripts": {
|
||||||
"build": "tsc --build",
|
"poststart": "npm run build",
|
||||||
"clean": "tsc --build --clean"
|
"start": "node dist/index.js",
|
||||||
},
|
"build": "tsc --build",
|
||||||
"dependencies": {
|
"clean": "tsc --build --clean"
|
||||||
"@discordjs/opus": "^0.8.0",
|
},
|
||||||
"@discordjs/voice": "^0.11.0",
|
"dependencies": {
|
||||||
"discord-ytdl-core": "^5.0.4",
|
"@discordjs/opus": "^0.8.0",
|
||||||
"discord.js": "^14.3.0",
|
"@discordjs/voice": "^0.11.0",
|
||||||
"tweetnacl": "^1.0.3",
|
"discord-ytdl-core": "^5.0.4",
|
||||||
"ytdl-core": "^4.11.1"
|
"discord.js": "^14.3.0",
|
||||||
},
|
"tweetnacl": "^1.0.3",
|
||||||
"devDependencies": {
|
"ytdl-core": "^4.11.1"
|
||||||
"@types/node": "^18.7.13",
|
},
|
||||||
"@typescript-eslint/eslint-plugin": "^5.35.1",
|
"devDependencies": {
|
||||||
"@typescript-eslint/parser": "^5.35.1",
|
"@types/node": "^18.7.13",
|
||||||
"eslint": "^8.22.0",
|
"@typescript-eslint/eslint-plugin": "^5.35.1",
|
||||||
"typescript": "^4.8.2"
|
"@typescript-eslint/parser": "^5.35.1",
|
||||||
}
|
"eslint": "^8.22.0",
|
||||||
|
"typescript": "^4.8.2"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
|
|
||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
|
|
||||||
import { CommandInteraction, GuildMember, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, GuildMember, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
if (!ctx.guild || !ctx.channel || !ctx.member) return;
|
if (!ctx.guild || !ctx.channel || !ctx.member) return;
|
||||||
@@ -9,8 +9,8 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
|||||||
await ctx.deferReply();
|
await ctx.deferReply();
|
||||||
|
|
||||||
const player =
|
const player =
|
||||||
client.modules.music.get(ctx.guild.id, ctx.channel) ||
|
client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel) ||
|
||||||
client.modules.music.set(ctx.guild, ctx.channel);
|
client.modules.music.set(ctx.guild, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player.Connection) {
|
if (!player.Connection) {
|
||||||
const channel = (ctx.member as GuildMember).voice.channel;
|
const channel = (ctx.member as GuildMember).voice.channel;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const filter = ctx.options.get("filter")?.value as string;
|
const filter = ctx.options.get("filter")?.value as string;
|
||||||
|
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
|
|
||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
if (!ctx.guild || !ctx.channel || !ctx.member) return;
|
if (!ctx.guild || !ctx.channel || !ctx.member) return;
|
||||||
|
|
||||||
await ctx.deferReply();
|
await ctx.deferReply();
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
await ctx.editReply({ embeds: [I18n.en.playerInfo(player)] });
|
await ctx.editReply({ embeds: [I18n.en.playerInfo(player)] });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const pos = ctx.options.get("position")?.value as number;
|
const pos = ctx.options.get("position")?.value as number;
|
||||||
@@ -8,7 +8,7 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
|||||||
|
|
||||||
if (!ctx.guild || !query || !pos || !ctx.channel) return;
|
if (!ctx.guild || !query || !pos || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const query = ctx.options.get("query")?.value as string;
|
const query = ctx.options.get("query")?.value as string;
|
||||||
|
|
||||||
if (!ctx.guild || !query || !ctx.channel) return;
|
if (!ctx.guild || !query || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import { loopOption } from "../lib/Types";
|
import { loopOption } from "../lib/Types.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const query = ctx.options.get("option")?.value as string;
|
const query = ctx.options.get("option")?.value as string;
|
||||||
|
|
||||||
if (!ctx.guild || !query || !ctx.channel) return;
|
if (!ctx.guild || !query || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import { run as connect } from "./connect";
|
import { run as connect } from "./connect.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const query = ctx.options.get("query")?.value as string;
|
const query = ctx.options.get("query")?.value as string;
|
||||||
|
|||||||
@@ -6,16 +6,17 @@ import {
|
|||||||
CommandInteraction,
|
CommandInteraction,
|
||||||
Message,
|
Message,
|
||||||
MessageActionRowComponentBuilder,
|
MessageActionRowComponentBuilder,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder,
|
||||||
|
TextChannel
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const query = ctx.options.get("query")?.value as string;
|
const query = ctx.options.get("query")?.value as string;
|
||||||
|
|
||||||
if (!ctx.guild || !query || !ctx.channel) return;
|
if (!ctx.guild || !query || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const hours = ctx.options.get("hrs")?.value as number || 0;
|
const hours = ctx.options.get("hrs")?.value as number || 0;
|
||||||
@@ -9,7 +9,7 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
|||||||
|
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
import { CommandInteraction, SlashCommandBuilder, TextChannel } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
|
|
||||||
export async function run(client: Client, ctx: CommandInteraction) {
|
export async function run(client: Client, ctx: CommandInteraction) {
|
||||||
const volume = ctx.options.get("volume")?.value as number || 100;
|
const volume = ctx.options.get("volume")?.value as number || 100;
|
||||||
|
|
||||||
if (!ctx.guild || !ctx.channel) return;
|
if (!ctx.guild || !ctx.channel) return;
|
||||||
|
|
||||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
const player = client.modules.music.get(ctx.guild.id, ctx.channel as TextChannel);
|
||||||
|
|
||||||
if (!player) return;
|
if (!player) return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
token: process.env.DISCORD_TOKEN,
|
token: process.env.DISCORD_TOKEN,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Interaction } from "discord.js";
|
import { Interaction } from "discord.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
|
|
||||||
export async function run(client: Client, args: Interaction[]): Promise<void> {
|
export async function run(client: Client, args: Interaction[]): Promise<void> {
|
||||||
const [interaction] = args;
|
const [interaction] = args;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import { generateDependencyReport } from "@discordjs/voice";
|
import { generateDependencyReport } from "@discordjs/voice";
|
||||||
import { ActivityType } from "discord.js";
|
import { ActivityType } from "discord.js";
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { VoiceState } from "discord.js";
|
import { VoiceState } from "discord.js";
|
||||||
import I18n from "../lib/I18n";
|
import I18n from "../lib/I18n.js";
|
||||||
import Client from "../lib/Client";
|
import Client from "../lib/Client.js";
|
||||||
import { asleep } from "../lib/Misc";
|
import { asleep } from "../lib/Misc.js";
|
||||||
|
|
||||||
export async function run(client: Client, args: VoiceState[]): Promise<void> {
|
export async function run(client: Client, args: VoiceState[]): Promise<void> {
|
||||||
const [oldState] = args;
|
const [oldState] = args;
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import Client from "./lib/Client";
|
import Client from "./lib/Client.js";
|
||||||
import config from "./config";
|
import config from "./config.js";
|
||||||
|
|
||||||
const client = new Client();
|
const client = new Client();
|
||||||
|
|
||||||
|
|||||||
+10
-9
@@ -1,11 +1,13 @@
|
|||||||
import {
|
import {
|
||||||
Client as DiscordClient
|
Client as DiscordClient,
|
||||||
|
GatewayIntentBits
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import { existsSync, readdirSync } from "fs";
|
import { existsSync, readdirSync } from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import Music from "./Music";
|
import Music from "./Music.js";
|
||||||
import { command, event } from "./Types";
|
import { command, event } from "./Types.js";
|
||||||
import config from "../config";
|
import config from "../config.js";
|
||||||
|
import { pathToFileURL } from "url";
|
||||||
|
|
||||||
export default class Client extends DiscordClient {
|
export default class Client extends DiscordClient {
|
||||||
private commands = new Map<string, command>();
|
private commands = new Map<string, command>();
|
||||||
@@ -21,9 +23,8 @@ export default class Client extends DiscordClient {
|
|||||||
public constructor() {
|
public constructor() {
|
||||||
super({
|
super({
|
||||||
intents: [
|
intents: [
|
||||||
"Guilds",
|
GatewayIntentBits.Guilds,
|
||||||
"GuildMessages",
|
GatewayIntentBits.GuildVoiceStates
|
||||||
"GuildVoiceStates",
|
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -33,7 +34,7 @@ export default class Client extends DiscordClient {
|
|||||||
);
|
);
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
import(path.join(config.commands, file)).then((cmd: command) =>
|
import(pathToFileURL(path.join(config.commands, file)).toString()).then((cmd: command) =>
|
||||||
this.commands.set(cmd.data.name, cmd)
|
this.commands.set(cmd.data.name, cmd)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -45,7 +46,7 @@ export default class Client extends DiscordClient {
|
|||||||
);
|
);
|
||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
import(path.join(config.events, file)).then((evnt: event) => {
|
import(pathToFileURL(path.join(config.events, file)).toString()).then((evnt: event) => {
|
||||||
this.on(evnt.name, (...args: unknown[]) =>
|
this.on(evnt.name, (...args: unknown[]) =>
|
||||||
evnt.run(this, args)
|
evnt.run(this, args)
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { ytdlArgs, ytdlResponse } from "./Types";
|
import { ytdlArgs, ytdlResponse } from "./Types.js";
|
||||||
import { execFile } from "child_process";
|
import { execFile } from "child_process";
|
||||||
import { promisify } from "util";
|
import { promisify } from "util";
|
||||||
import config from "../config";
|
import config from "../config.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
const execFileAsync = promisify(execFile);
|
const execFileAsync = promisify(execFile);
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
import Player from "./Player";
|
import Player from "./Player.js";
|
||||||
import { loopOption, track } from "./Types";
|
import { loopOption, track } from "./Types.js";
|
||||||
import { loopMoji, secToISO, statusBarGenerator, volumeMoji } from "./Misc";
|
import { loopMoji, secToISO, statusBarGenerator, volumeMoji } from "./Misc.js";
|
||||||
import Queue from "./Queue";
|
import Queue from "./Queue.js";
|
||||||
import { AudioResource } from "@discordjs/voice";
|
import { AudioResource } from "@discordjs/voice";
|
||||||
import { EmbedBuilder } from "discord.js";
|
import { EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { loopOption } from "./Types";
|
import { loopOption } from "./Types.js";
|
||||||
|
|
||||||
export function statusBarGenerator(duration: number, length: number): string {
|
export function statusBarGenerator(duration: number, length: number): string {
|
||||||
duration = Math.max(0, duration);
|
duration = Math.max(0, duration);
|
||||||
|
|||||||
+4
-4
@@ -1,10 +1,10 @@
|
|||||||
import { Guild, TextBasedChannel } from "discord.js";
|
import { Guild, TextChannel } from "discord.js";
|
||||||
import Player from "./Player";
|
import Player from "./Player.js";
|
||||||
|
|
||||||
export default class Music {
|
export default class Music {
|
||||||
private players = new Map<string, Player>();
|
private players = new Map<string, Player>();
|
||||||
|
|
||||||
public get(guildId: string, channel?: TextBasedChannel): Player | undefined {
|
public get(guildId: string, channel?: TextChannel): Player | undefined {
|
||||||
const player = this.players.get(guildId);
|
const player = this.players.get(guildId);
|
||||||
if (player) {
|
if (player) {
|
||||||
if (channel) player.Channel = channel;
|
if (channel) player.Channel = channel;
|
||||||
@@ -12,7 +12,7 @@ export default class Music {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public set(guild: Guild, channel: TextBasedChannel): Player {
|
public set(guild: Guild, channel: TextChannel): Player {
|
||||||
const player = new Player(guild, this, channel);
|
const player = new Player(guild, this, channel);
|
||||||
this.players.set(guild.id, player);
|
this.players.set(guild.id, player);
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -14,30 +14,30 @@ import {
|
|||||||
import {
|
import {
|
||||||
Guild,
|
Guild,
|
||||||
Message,
|
Message,
|
||||||
TextBasedChannel,
|
TextChannel,
|
||||||
User,
|
User,
|
||||||
VoiceBasedChannel,
|
VoiceBasedChannel,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
|
|
||||||
import Music from "./Music";
|
import Music from "./Music.js";
|
||||||
import Filter from "./Filter";
|
import Filter from "./Filter.js";
|
||||||
import Queue from "./Queue";
|
import Queue from "./Queue.js";
|
||||||
import { fetchStream } from "./Fetch";
|
import { fetchStream } from "./Fetch.js";
|
||||||
import I18n from "./I18n";
|
import I18n from "./I18n.js";
|
||||||
|
|
||||||
import ytdl from "discord-ytdl-core";
|
import ytdl from "discord-ytdl-core";
|
||||||
import { track } from "./Types";
|
import { track } from "./Types.js";
|
||||||
import { largestCommonSequence } from "./Misc";
|
import { largestCommonSequence } from "./Misc.js";
|
||||||
|
|
||||||
export default class Player {
|
export default class Player {
|
||||||
private music: Music;
|
private music: Music;
|
||||||
private guild: Guild;
|
private guild: Guild;
|
||||||
|
|
||||||
private channel: TextBasedChannel;
|
private channel: TextChannel;
|
||||||
public get Channel(): TextBasedChannel {
|
public get Channel(): TextChannel {
|
||||||
return this.channel;
|
return this.channel;
|
||||||
}
|
}
|
||||||
public set Channel(x: TextBasedChannel) {
|
public set Channel(x: TextChannel) {
|
||||||
this.channel = x;
|
this.channel = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,11 +84,11 @@ export default class Player {
|
|||||||
public constructor(
|
public constructor(
|
||||||
guild: Guild,
|
guild: Guild,
|
||||||
music: Music,
|
music: Music,
|
||||||
textBasedChannel: TextBasedChannel
|
textChannel: TextChannel
|
||||||
) {
|
) {
|
||||||
this.music = music;
|
this.music = music;
|
||||||
this.guild = guild;
|
this.guild = guild;
|
||||||
this.channel = textBasedChannel;
|
this.channel = textChannel;
|
||||||
|
|
||||||
this.player = createAudioPlayer();
|
this.player = createAudioPlayer();
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { loopOption, track } from "./Types";
|
import { loopOption, track } from "./Types.js";
|
||||||
|
|
||||||
export default class Queue {
|
export default class Queue {
|
||||||
private tracks: track[] = [];
|
private tracks: track[] = [];
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { ApplicationCommandData, User, CommandInteraction } from "discord.js";
|
import { ApplicationCommandData, User, CommandInteraction } from "discord.js";
|
||||||
import Client from "./Client";
|
import Client from "./Client.js";
|
||||||
|
|
||||||
export type track = {
|
export type track = {
|
||||||
url: string;
|
url: string;
|
||||||
|
|||||||
+15
-15
@@ -1,19 +1,19 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"strict": true,
|
"strict": true,
|
||||||
|
|
||||||
"module": "CommonJS",
|
"module": "ESNext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
"removeComments": false,
|
"removeComments": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"lib": ["ESNext"],
|
"lib": ["ESNext"],
|
||||||
"types": ["node"],
|
"types": ["node"],
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true
|
||||||
},
|
},
|
||||||
"include": ["src/**/*"],
|
"include": ["src/**/*"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user