mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-12 21:05:29 +01:00
Bump packages, add debug logging
This commit is contained in:
parent
6eb704c5b4
commit
9d8275bbda
|
@ -81,17 +81,17 @@
|
|||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/builders": "^0.9.0",
|
||||
"@discordjs/builders": "^0.12.0",
|
||||
"@discordjs/opus": "^0.7.0",
|
||||
"@discordjs/rest": "^0.1.0-canary.0",
|
||||
"@discordjs/voice": "^0.7.5",
|
||||
"@discordjs/rest": "^0.3.0",
|
||||
"@discordjs/voice": "^0.8.0",
|
||||
"@prisma/client": "^3.8.1",
|
||||
"@types/libsodium-wrappers": "^0.7.9",
|
||||
"array-shuffle": "^3.0.0",
|
||||
"debug": "^4.3.3",
|
||||
"delay": "^5.0.0",
|
||||
"discord-api-types": "^0.26.1",
|
||||
"discord.js": "^13.5.0",
|
||||
"discord.js": "^13.6.0",
|
||||
"dotenv": "^8.5.1",
|
||||
"execa": "^6.0.0",
|
||||
"fluent-ffmpeg": "^2.1.2",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import {inject, injectable} from 'inversify';
|
||||
import {Client} from 'discord.js';
|
||||
import {TYPES} from '../types.js';
|
||||
import Player from '../services/player.js';
|
||||
import FileCacheProvider from '../services/file-cache.js';
|
||||
|
@ -7,12 +6,10 @@ import FileCacheProvider from '../services/file-cache.js';
|
|||
@injectable()
|
||||
export default class {
|
||||
private readonly guildPlayers: Map<string, Player>;
|
||||
private readonly discordClient: Client;
|
||||
private readonly fileCache: FileCacheProvider;
|
||||
|
||||
constructor(@inject(TYPES.FileCache) fileCache: FileCacheProvider, @inject(TYPES.Client) client: Client) {
|
||||
constructor(@inject(TYPES.FileCache) fileCache: FileCacheProvider) {
|
||||
this.guildPlayers = new Map();
|
||||
this.discordClient = client;
|
||||
this.fileCache = fileCache;
|
||||
}
|
||||
|
||||
|
@ -20,7 +17,7 @@ export default class {
|
|||
let player = this.guildPlayers.get(guildId);
|
||||
|
||||
if (!player) {
|
||||
player = new Player(this.discordClient, this.fileCache, guildId);
|
||||
player = new Player(this.fileCache, guildId);
|
||||
|
||||
this.guildPlayers.set(guildId, player);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import {VoiceChannel, Snowflake, Client, TextChannel} from 'discord.js';
|
||||
import {VoiceChannel, Snowflake} from 'discord.js';
|
||||
import {Readable} from 'stream';
|
||||
import hasha from 'hasha';
|
||||
import ytdl from 'ytdl-core';
|
||||
import {WriteStream} from 'fs-capacitor';
|
||||
import ffmpeg from 'fluent-ffmpeg';
|
||||
import shuffle from 'array-shuffle';
|
||||
import errorMsg from '../utils/error-msg.js';
|
||||
import {AudioPlayer, AudioPlayerStatus, createAudioPlayer, createAudioResource, joinVoiceChannel, StreamType, VoiceConnection, VoiceConnectionStatus} from '@discordjs/voice';
|
||||
import FileCacheProvider from './file-cache.js';
|
||||
import debug from '../utils/debug.js';
|
||||
|
||||
export interface QueuedPlaylist {
|
||||
title: string;
|
||||
|
@ -49,11 +49,9 @@ export default class {
|
|||
|
||||
private positionInSeconds = 0;
|
||||
|
||||
private readonly discordClient: Client;
|
||||
private readonly fileCache: FileCacheProvider;
|
||||
|
||||
constructor(client: Client, fileCache: FileCacheProvider, guildId: string) {
|
||||
this.discordClient = client;
|
||||
constructor(fileCache: FileCacheProvider, guildId: string) {
|
||||
this.fileCache = fileCache;
|
||||
this.guildId = guildId;
|
||||
}
|
||||
|
@ -62,7 +60,6 @@ export default class {
|
|||
const conn = joinVoiceChannel({
|
||||
channelId: channel.id,
|
||||
guildId: channel.guild.id,
|
||||
// @ts-expect-error (see https://github.com/discordjs/voice/issues/166)
|
||||
adapterCreator: channel.guild.voiceAdapterCreator,
|
||||
});
|
||||
|
||||
|
@ -150,9 +147,11 @@ export default class {
|
|||
const stream = await this.getStream(currentSong.url);
|
||||
this.audioPlayer = createAudioPlayer();
|
||||
this.voiceConnection.subscribe(this.audioPlayer);
|
||||
this.audioPlayer.play(createAudioResource(stream, {
|
||||
const resource = createAudioResource(stream, {
|
||||
inputType: StreamType.WebmOpus,
|
||||
}));
|
||||
});
|
||||
|
||||
this.audioPlayer.play(resource);
|
||||
|
||||
this.attachListeners();
|
||||
|
||||
|
@ -167,14 +166,13 @@ export default class {
|
|||
this.lastSongURL = currentSong.url;
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
const currentSong = this.getCurrent();
|
||||
await this.forward(1);
|
||||
|
||||
if ((error as {statusCode: number}).statusCode === 410 && currentSong) {
|
||||
const channelId = currentSong.addedInChannelId;
|
||||
|
||||
if (channelId) {
|
||||
await (this.discordClient.channels.cache.get(channelId) as TextChannel).send(errorMsg(`${currentSong.title} is unavailable`));
|
||||
debug(`${currentSong.title} is unavailable`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -405,6 +403,9 @@ export default class {
|
|||
.on('error', error => {
|
||||
console.error(error);
|
||||
reject(error);
|
||||
})
|
||||
.on('start', command => {
|
||||
debug(`Spawned ffmpeg with ${command as string}`);
|
||||
});
|
||||
|
||||
youtubeStream.pipe(capacitor);
|
||||
|
|
90
yarn.lock
90
yarn.lock
|
@ -53,22 +53,17 @@
|
|||
tslib "^2.3.1"
|
||||
zod "^3.11.6"
|
||||
|
||||
"@discordjs/builders@^0.9.0":
|
||||
version "0.9.0"
|
||||
resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-0.9.0.tgz#1ca17677e7c180d4f266191596e17e9633180417"
|
||||
integrity sha512-XM/5yrTxMF0SDKza32YzGDQO1t+qEJTaF8Zvxu/UOjzoqzMPPGQBjC1VgZxz8/CBLygW5qI+UVygMa88z13G3g==
|
||||
"@discordjs/builders@^0.12.0":
|
||||
version "0.12.0"
|
||||
resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-0.12.0.tgz#5f6d95d1b231fa975a7e28ca3f8098e517676887"
|
||||
integrity sha512-Vx2MjUZd6QVo1uS2uWt708Fd6cHWGFblAvbpL5EBO+kLl0BADmPwwvts+YJ/VfSywed6Vsk6K2cEooR/Ytjhjw==
|
||||
dependencies:
|
||||
"@sindresorhus/is" "^4.2.0"
|
||||
discord-api-types "^0.24.0"
|
||||
"@sindresorhus/is" "^4.3.0"
|
||||
discord-api-types "^0.26.1"
|
||||
ts-mixer "^6.0.0"
|
||||
tslib "^2.3.1"
|
||||
zod "^3.11.6"
|
||||
|
||||
"@discordjs/collection@^0.1.6":
|
||||
version "0.1.6"
|
||||
resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.1.6.tgz#9e9a7637f4e4e0688fd8b2b5c63133c91607682c"
|
||||
integrity sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ==
|
||||
|
||||
"@discordjs/collection@^0.4.0":
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.4.0.tgz#b6488286a1cc7b41b644d7e6086f25a1c1e6f837"
|
||||
|
@ -97,31 +92,30 @@
|
|||
"@discordjs/node-pre-gyp" "^0.4.2"
|
||||
node-addon-api "^4.2.0"
|
||||
|
||||
"@discordjs/rest@^0.1.0-canary.0":
|
||||
version "0.1.0-canary.0"
|
||||
resolved "https://registry.yarnpkg.com/@discordjs/rest/-/rest-0.1.0-canary.0.tgz#666f9a1a0c1f2f5a09a3a79f77aeddaeafbcbcc1"
|
||||
integrity sha512-d+s//ISYVV+e0w/926wMEeO7vju+Pn11x1JM4tcmVMCHSDgpi6pnFCNAXF1TEdnDcy7xf9tq5cf2pQkb/7ySTQ==
|
||||
"@discordjs/rest@^0.3.0":
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@discordjs/rest/-/rest-0.3.0.tgz#89e06a42b168c91598891d6bf860353e28fba5d2"
|
||||
integrity sha512-F9aeP3odlAlllM1ciBZLdd+adiAyBj4VaZBejj4UMj4afE2wfCkNTGvYYiRxrXUE9fN7e/BuDP2ePl0tVA2m7Q==
|
||||
dependencies:
|
||||
"@discordjs/collection" "^0.1.6"
|
||||
"@sapphire/async-queue" "^1.1.4"
|
||||
"@sapphire/snowflake" "^1.3.5"
|
||||
abort-controller "^3.0.0"
|
||||
discord-api-types "^0.18.1"
|
||||
"@discordjs/collection" "^0.4.0"
|
||||
"@sapphire/async-queue" "^1.1.9"
|
||||
"@sapphire/snowflake" "^3.0.1"
|
||||
discord-api-types "^0.26.1"
|
||||
form-data "^4.0.0"
|
||||
node-fetch "^2.6.1"
|
||||
tslib "^2.3.0"
|
||||
node-fetch "^2.6.5"
|
||||
tslib "^2.3.1"
|
||||
|
||||
"@discordjs/voice@^0.7.5":
|
||||
version "0.7.5"
|
||||
resolved "https://registry.yarnpkg.com/@discordjs/voice/-/voice-0.7.5.tgz#c95bd4ecf73905f51990827df5209eb26472dbd5"
|
||||
integrity sha512-lUk+CmIXNKslT6DkC9IF9rpsqhzlTiedauUCPBzepjd4XWxwBZiyVIzR6QpbAirxkAwCoAbbje+3Ho71PGLEAw==
|
||||
"@discordjs/voice@^0.8.0":
|
||||
version "0.8.0"
|
||||
resolved "https://registry.yarnpkg.com/@discordjs/voice/-/voice-0.8.0.tgz#5d790fc25b883698f6eb7762efe1af00b6440947"
|
||||
integrity sha512-o0JfVLMs3eLjUzPf6oxMydEeum40I7xzfUc66SLN+RrKpSAsTbngf5qnCF53nm+KDNSvrwg1AZqNm4LEAdxJIA==
|
||||
dependencies:
|
||||
"@types/ws" "^8.2.0"
|
||||
discord-api-types "^0.24.0"
|
||||
discord-api-types "^0.26.1"
|
||||
prism-media "^1.3.2"
|
||||
tiny-typed-emitter "^2.1.0"
|
||||
tslib "^2.3.1"
|
||||
ws "^8.2.3"
|
||||
ws "^8.4.2"
|
||||
|
||||
"@eslint/eslintrc@^0.4.3":
|
||||
version "0.4.3"
|
||||
|
@ -303,22 +297,22 @@
|
|||
dependencies:
|
||||
detect-newline "^3.1.0"
|
||||
|
||||
"@sapphire/async-queue@^1.1.4", "@sapphire/async-queue@^1.1.9":
|
||||
"@sapphire/async-queue@^1.1.9":
|
||||
version "1.1.9"
|
||||
resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.1.9.tgz#ce69611c8753c4affd905a7ef43061c7eb95c01b"
|
||||
integrity sha512-CbXaGwwlEMq+l1TRu01FJCvySJ1CEFKFclHT48nIfNeZXaAAmmwwy7scUKmYHPUa3GhoMp6Qr1B3eAJux6XgOQ==
|
||||
|
||||
"@sapphire/snowflake@^1.3.5":
|
||||
version "1.3.6"
|
||||
resolved "https://registry.yarnpkg.com/@sapphire/snowflake/-/snowflake-1.3.6.tgz#166e8c5c08d01c861edd7e2edc80b5739741715f"
|
||||
integrity sha512-QnzuLp+p9D7agynVub/zqlDVriDza9y3STArBhNiNBUgIX8+GL5FpQxstRfw1jDr5jkZUjcuKYAHxjIuXKdJAg==
|
||||
"@sapphire/snowflake@^3.0.1":
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@sapphire/snowflake/-/snowflake-3.1.0.tgz#1c2d9781d3b1de0bcb02b7079898947ce754d394"
|
||||
integrity sha512-K+OiqXSx4clIaXcoaghrCV56zsm3bZZ5SBpgJkgvAKegFFdETMntHviUfypjt8xVleIuDaNyQA4APOIl3BMcxg==
|
||||
|
||||
"@sindresorhus/is@^0.14.0":
|
||||
version "0.14.0"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
|
||||
integrity sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==
|
||||
|
||||
"@sindresorhus/is@^4.0.0", "@sindresorhus/is@^4.2.0":
|
||||
"@sindresorhus/is@^4.0.0", "@sindresorhus/is@^4.2.0", "@sindresorhus/is@^4.3.0":
|
||||
version "4.4.0"
|
||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.4.0.tgz#e277e5bdbdf7cb1e20d320f02f5e2ed113cd3185"
|
||||
integrity sha512-QppPM/8l3Mawvh4rn9CNEYIU9bxpXUCRMaX9yUpvBk1nMKusLKpfXGDEKExKaPhLzcn3lzil7pR6rnJ11HgeRQ==
|
||||
|
@ -556,13 +550,6 @@ abbrev@1:
|
|||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
||||
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
|
||||
|
||||
abort-controller@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
|
||||
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
|
||||
dependencies:
|
||||
event-target-shim "^5.0.0"
|
||||
|
||||
acorn-jsx@^5.3.1:
|
||||
version "5.3.2"
|
||||
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
|
||||
|
@ -1205,22 +1192,12 @@ dir-glob@^3.0.1:
|
|||
dependencies:
|
||||
path-type "^4.0.0"
|
||||
|
||||
discord-api-types@^0.18.1:
|
||||
version "0.18.1"
|
||||
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.18.1.tgz#5d08ed1263236be9c21a22065d0e6b51f790f492"
|
||||
integrity sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==
|
||||
|
||||
discord-api-types@^0.24.0:
|
||||
version "0.24.0"
|
||||
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.24.0.tgz#9e429b8a1ddb4147134dfb3109093422de7ec549"
|
||||
integrity sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A==
|
||||
|
||||
discord-api-types@^0.26.0, discord-api-types@^0.26.1:
|
||||
version "0.26.1"
|
||||
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.26.1.tgz#726f766ddc37d60da95740991d22cb6ef2ed787b"
|
||||
integrity sha512-T5PdMQ+Y1MEECYMV5wmyi9VEYPagEDEi4S0amgsszpWY0VB9JJ/hEvM6BgLhbdnKky4gfmZEXtEEtojN8ZKJQQ==
|
||||
|
||||
discord.js@^13.5.0:
|
||||
discord.js@^13.6.0:
|
||||
version "13.6.0"
|
||||
resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-13.6.0.tgz#d8a8a591dbf25cbcf9c783d5ddf22c4694860475"
|
||||
integrity sha512-tXNR8zgsEPxPBvGk3AQjJ9ljIIC6/LOPjzKwpwz8Y1Q2X66Vi3ZqFgRHYwnHKC0jC0F+l4LzxlhmOJsBZDNg9g==
|
||||
|
@ -1440,11 +1417,6 @@ esutils@^2.0.2:
|
|||
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64"
|
||||
integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==
|
||||
|
||||
event-target-shim@^5.0.0:
|
||||
version "5.0.1"
|
||||
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
|
||||
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
|
||||
|
||||
eventemitter3@^4.0.7:
|
||||
version "4.0.7"
|
||||
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
|
||||
|
@ -3496,7 +3468,7 @@ tslib@^1.8.1, tslib@^1.9.0:
|
|||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
|
||||
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==
|
||||
|
||||
tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1:
|
||||
tslib@^2.1.0, tslib@^2.3.1:
|
||||
version "2.3.1"
|
||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
|
||||
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
|
||||
|
@ -3712,7 +3684,7 @@ write-file-atomic@^3.0.0:
|
|||
signal-exit "^3.0.2"
|
||||
typedarray-to-buffer "^3.1.5"
|
||||
|
||||
ws@^8.2.3, ws@^8.4.0:
|
||||
ws@^8.4.0, ws@^8.4.2:
|
||||
version "8.4.2"
|
||||
resolved "https://registry.yarnpkg.com/ws/-/ws-8.4.2.tgz#18e749868d8439f2268368829042894b6907aa0b"
|
||||
integrity sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==
|
||||
|
|
Loading…
Reference in a new issue