codetheweb / muse

🎧 a self-hosted midwestern Discord music bot that doesn't suck
MIT License
800 stars 206 forks source link

"That doesn't exist" on all play commands #461

Closed Quinten0508 closed 2 years ago

Quinten0508 commented 2 years ago

Running the bot in a Docker container on a raspberry pi (ARM 32-bit).

The bot starts up fine and the setup works, but as soon as I try to use the play command it always replies with that doesn't exist and does not play a song or add it to the queue. Here is a screenshot of the error message: image

codetheweb commented 2 years ago

Please update to v0.3.0 and try again.

Note that because of a dependency change, 32-bit ARM is no longer supported. So you'll have to run your Pi in 64-bit mode (if possible) or use a different device.

Quinten0508 commented 2 years ago

Running my pi in 64 bit mode and completely nuked the container before reinstalling just in case. Running docker-compose up -d now results in Pulling muse (codetheweb/muse:latest)... latest: Pulling from codetheweb/muse ERROR: no matching manifest for linux/arm/v7 in the manifest list entries

codetheweb commented 2 years ago

linux/arm/v7 is 32-bit so Docker isn't running in 64-bit mode. You might need to reinstall Docker. It should pull linux/arm64.

Quinten0508 commented 2 years ago

Running uname -a shows 64 bit, docker version shows linux/arm, but it still tries to pull the 32 bit image. I'll try raspbian 64 bit tomorrow, seems like just enabling a 64 bit kernel doesn't do it for docker. Thanks for the help!

Quinten0508 commented 2 years ago

Update:

codetheweb commented 2 years ago

Hmm, could you try checking out 65dd43a (build Docker image locally from that or just run directly)? Won't solve your issue but should provide some additional context.

Run with the env var DEBUG=* and see if anything pops up.

Quinten0508 commented 2 years ago

I don't fully understand, not that experienced yet 😅 How would I go about this?

codetheweb commented 2 years ago

Follow the instructions here: https://github.com/codetheweb/muse#nodejs

You'll need to install Node.js first if you haven't already, I recommend using v16 and something like nvm.

Quinten0508 commented 2 years ago

Thanks! Installed nvm and the latest Nodejs 16 LTS, got this when using yarn install:

gyp ERR! System Linux 5.4.0-1048-raspi
gyp ERR! command "/home/ubuntu/.nvm/versions/node/v16.13.1/bin/node" "/home/ubuntu/muse/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /home/ubuntu/muse/node_modules/sqlite3
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/ubuntu/.nvm/versions/node/v16.13.1/bin/node /home/ubuntu/muse/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/ubuntu/muse/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Linux 5.4.0-1048-raspi
node-pre-gyp ERR! command "/home/ubuntu/.nvm/versions/node/v16.13.1/bin/node" "/home/ubuntu/muse/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/ubuntu/muse/node_modules/sqlite3
node-pre-gyp ERR! node -v v16.13.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok 
Failed to execute '/home/ubuntu/.nvm/versions/node/v16.13.1/bin/node /home/ubuntu/muse/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3

Then running yarn build fails:

yarn run v1.22.15
$ tsc
src/services/player.ts:56:7 - error TS2322: Type 'InternalDiscordGatewayAdapterCreator' is not assignable to type 'DiscordGatewayAdapterCreator'.
  Types of parameters 'methods' and 'methods' are incompatible.
    Type 'DiscordGatewayAdapterLibraryMethods' is not assignable to type 'InternalDiscordGatewayAdapterLibraryMethods'.
      Types of property 'onVoiceStateUpdate' are incompatible.
        Type '(data: import("/home/ubuntu/muse/node_modules/@discordjs/voice/node_modules/discord-api-types/payloads/v9/voice").GatewayVoiceState) => void' is not assignable to type '(data: import("/home/ubuntu/muse/node_modules/discord-api-types/payloads/v9/voice").GatewayVoiceState) => void'.
          Types of parameters 'data' and 'data' are incompatible.
            Type 'import("/home/ubuntu/muse/node_modules/discord-api-types/payloads/v9/voice").GatewayVoiceState' is not assignable to type 'import("/home/ubuntu/muse/node_modules/@discordjs/voice/node_modules/discord-api-types/payloads/v9/voice").GatewayVoiceState'.
              Types of property 'member' are incompatible.
                Type 'import("/home/ubuntu/muse/node_modules/discord-api-types/payloads/v9/guild").APIGuildMember | undefined' is not assignable to type 'import("/home/ubuntu/muse/node_modules/@discordjs/voice/node_modules/discord-api-types/payloads/v9/guild").APIGuildMember | undefined'.
                  Type 'import("/home/ubuntu/muse/node_modules/discord-api-types/payloads/v9/guild").APIGuildMember' is not assignable to type 'import("/home/ubuntu/muse/node_modules/@discordjs/voice/node_modules/discord-api-types/payloads/v9/guild").APIGuildMember'.
                    Types of property 'user' are incompatible.
                      Type 'import("/home/ubuntu/muse/node_modules/discord-api-types/payloads/v9/user").APIUser | undefined' is not assignable to type 'import("/home/ubuntu/muse/node_modules/@discordjs/voice/node_modules/discord-api-types/payloads/v9/user").APIUser | undefined'.
                        Type 'import("/home/ubuntu/muse/node_modules/discord-api-types/payloads/v9/user").APIUser' is not assignable to type 'import("/home/ubuntu/muse/node_modules/@discordjs/voice/node_modules/discord-api-types/payloads/v9/user").APIUser'.
                          Types of property 'flags' are incompatible.
                            Type 'import("/home/ubuntu/muse/node_modules/discord-api-types/payloads/v9/user").UserFlags | undefined' is not assignable to type 'import("/home/ubuntu/muse/node_modules/@discordjs/voice/node_modules/discord-api-types/payloads/v9/user").UserFlags | undefined'.
                              Type 'UserFlags.None' is not assignable to type 'UserFlags | undefined'.

56       adapterCreator: channel.guild.voiceAdapterCreator,
         ~~~~~~~~~~~~~~

  node_modules/@discordjs/voice/dist/index.d.ts:1526:5
    1526     adapterCreator: DiscordGatewayAdapterCreator;
             ~~~~~~~~~~~~~~
    The expected type comes from property 'adapterCreator' which is declared here on type 'JoinVoiceChannelOptions & CreateVoiceConnectionOptions'

Found 1 error.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
codetheweb commented 2 years ago

SQLite is no longer necessary as a dependency since migrating to Prisma, I just pushed a commit that removes it.

Try pulling and running yarn install again.

Not sure why build is failing; maybe it's using a different version of Discord.js since yarn install failed part way through?

Quinten0508 commented 2 years ago

Yes, sqlite is causing it to fail. Just cloned the repo again cause I was trying some other things to try and fix it too, still fails on sqlite somehow?

yarn install v1.22.15
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
[5/5] Building fresh packages...
[1/7] ⠐ @discordjs/opus
[7/7] ⠈ @prisma/client
[3/7] ⠈ sqlite3
[-/7] ⠈ waiting...
error /home/ubuntu/muse/node_modules/sqlite3: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /home/ubuntu/muse/node_modules/sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.11.0
node-pre-gyp info using node@16.13.1 | linux | arm64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm64.tar.gz
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@5.0.2 and node@16.13.1 (node-v93 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.2/napi-v3-linux-arm64.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@16.13.1 | linux | arm64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@16.13.1 | linux | arm64
(node:171642) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '/home/ubuntu/muse/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ubuntu/muse/node_modules/sqlite3/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ubuntu/muse/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/ubuntu/.node-gyp/16.13.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/ubuntu/.node-gyp/16.13.1',
gyp info spawn args   '-Dnode_gyp_dir=/home/ubuntu/muse/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/ubuntu/.node-gyp/16.13.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/ubuntu/muse/node_modules/sqlite3',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@16.13.1 | linux | arm64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/ubuntu/muse/node_modules/sqlite3/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
  AR(target) Release/obj.target/../node-addon-api/nothing.a
  COPY Release/nothing.a
  ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c
/bin/sh: 1: python: not found
make: *** [deps/action_before_build.target.mk:13: Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c] Error 127
make: Leaving directory '/home/ubuntu/muse/node_modules/sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/ubuntu/muse/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 5.4.0-1048-raspi
gyp ERR! command "/home/ubuntu/.nvm/versions/node/v16.13.1/bin/node" "/home/ubuntu/muse/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--node_napi_label=napi-v3"
gyp ERR! cwd /home/ubuntu/muse/node_modules/sqlite3
gyp ERR! node -v v16.13.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/home/ubuntu/.nvm/versions/node/v16.13.1/bin/node /home/ubuntu/muse/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/ubuntu/muse/node_modules/sqlite3/lib/binding/napi-v3-linux-arm64 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/ubuntu/muse/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
node-pre-gyp ERR! System Linux 5.4.0-1048-raspi
node-pre-gyp ERR! command "/home/ubuntu/.nvm/versions/node/v16.13.1/bin/node" "/home/ubuntu/muse/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/ubuntu/muse/node_modules/sqlite3
node-pre-gyp ERR! node -v v16.13.1
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/home/ubuntu/.nvm/versions/node/v16.13.1/bin/node /home/ubuntu/muse/node_modules/node-gyp/bin/node-gyp.js build
codetheweb commented 2 years ago

sqlite3 no longer appears in yarn.lock, so if it's trying to be installed you must not have the latest code checked out. Try git pull. What does git log show?

Quinten0508 commented 2 years ago

git pull gives Already up to date. git log has a huge output: https://hastebin.nl/QjpZNyf

codetheweb commented 2 years ago

Hmm, that looks right.

Try git status to make sure there's no difference between your working directory and the latest commit? If package-lock.json is showing up (maybe you did npm install at some point), delete that.

Quinten0508 commented 2 years ago

git status gives this:

On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

There's no package-lock.json present, never ran npm install.

Quinten0508 commented 2 years ago

Rebooted my raspberry pi, it seems to be gone now? Weird, must be some kind of caching going on. Either way, running yarn install again now, might take a while.

Quinten0508 commented 2 years ago

Okay, yarn install, yarn build, and yarn start all worked, but the bot still gives the same error when requesting to play a song. This is what it outputs when I send ?play https://www.youtube.com/watch?v=dQw4w9gXcQ :

prisma:client:libraryEngine sending request, this.libraryStarted: true +187msh  muse [WS => Shard 0] [HeartbeatTimer] Sending a heartbeat. +41s
  prisma:client Prisma Client call: +36s
  prisma:client prisma.setting.findUnique({
  prisma:client   where: {
  prisma:client     guildId: '713796245793144883'
  prisma:client   }
  prisma:client }) +0ms
  prisma:client Generated request: +1ms
  prisma:client query {
  prisma:client   findUniqueSetting(where: {
  prisma:client     guildId: "713796245793144883"
  prisma:client   }) {
  prisma:client     guildId
  prisma:client     prefix
  prisma:client     channel
  prisma:client     finishedSetup
  prisma:client     playlistLimit
  prisma:client     createdAt
  prisma:client     updatedAt
  prisma:client   }
  prisma:client }
  prisma:client  +0ms
  prisma:client:libraryEngine sending request, this.libraryStarted: true +36s
  muse [WS => Shard 0] Heartbeat acknowledged, latency of 99ms. +99ms
  prisma:client Prisma Client call: +165ms
  prisma:client prisma.setting.findUnique({
  prisma:client   where: {
  prisma:client     guildId: '713796245793144883'
  prisma:client   }
  prisma:client }) +1ms
  prisma:client Generated request: +0ms
  prisma:client query {
  prisma:client   findUniqueSetting(where: {
  prisma:client     guildId: "713796245793144883"
  prisma:client   }) {
  prisma:client     guildId
  prisma:client     prefix
  prisma:client     channel
  prisma:client     finishedSetup
  prisma:client     playlistLimit
  prisma:client     createdAt
  prisma:client     updatedAt
  prisma:client   }
  prisma:client }
  prisma:client  +0ms
  prisma:client:libraryEngine sending request, this.libraryStarted: true +166ms
Quinten0508 commented 2 years ago

rebooted my pi a few hrs ago, now yarn build spits out the error again. Found https://github.com/discordjs/voice/issues/166 with the same issue, will look into that.

codetheweb commented 2 years ago

It appears that something's weird on YouTube's side for https://www.youtube.com/watch?v=dQw4w9gXcQ. It works in the web player, but asking the API for dQw4w9gXcQ yields an empty / incorrect response. When sharing that video from the web player, it gives a different ID: dQw4w9WgXcQ. That ID works using the API. The video URL is correct in Muse's help message (has ID dQw4w9WgXcQ and the sample command works for me), so maybe you accidentally edited it when copying?

Does a free-form search like ?play cool music work?

Just pushed 892c06a which fixes your compilation error.

Quinten0508 commented 2 years ago

None of the "play" commands work: spotify, search and youtube all give the same error (https://github.com/codetheweb/muse/commit/892c06a1109480ba581f99b09d55c929c9a37f0a did not change this). I checked network traffic and the freeform search does seem to do something in terms of network, but I'm unsure how to continue.

https://github.com/codetheweb/muse/commit/892c06a1109480ba581f99b09d55c929c9a37f0a did solve the build issue, no errors are shown now. yarn start seems to work as before. Is there any verbosity I can add to yarn start with parameters? Nothing new shows up in terminal when I issue a "play" command:

prisma:client:libraryEngine sending request, this.libraryStarted: true +357ms
  muse [WS => Shard 0] [HeartbeatTimer] Sending a heartbeat. +41s
  muse [WS => Shard 0] Heartbeat acknowledged, latency of 103ms. +103ms
  prisma:client Prisma Client call: +1m
  prisma:client prisma.setting.findUnique({
  prisma:client   where: {
  prisma:client     guildId: '713796245793144883'
  prisma:client   }
  prisma:client }) +2ms
  prisma:client Generated request: +0ms
  prisma:client query {
  prisma:client   findUniqueSetting(where: {
  prisma:client     guildId: "713796245793144883"
  prisma:client   }) {
  prisma:client     guildId
  prisma:client     prefix
  prisma:client     channel
  prisma:client     finishedSetup
  prisma:client     playlistLimit
  prisma:client     createdAt
  prisma:client     updatedAt
  prisma:client   }
  prisma:client }
  prisma:client  +0ms
  prisma:client:libraryEngine sending request, this.libraryStarted: true +1m
  prisma:client Prisma Client call: +179ms
  prisma:client prisma.setting.findUnique({
  prisma:client   where: {
  prisma:client     guildId: '713796245793144883'
  prisma:client   }
  prisma:client }) +1ms
  prisma:client Generated request: +1ms
  prisma:client query {
  prisma:client   findUniqueSetting(where: {
  prisma:client     guildId: "713796245793144883"
  prisma:client   }) {
  prisma:client     guildId
  prisma:client     prefix
  prisma:client     channel
  prisma:client     finishedSetup
  prisma:client     playlistLimit
  prisma:client     createdAt
  prisma:client     updatedAt
  prisma:client   }
  prisma:client }
  prisma:client  +0ms
  prisma:client:libraryEngine sending request, this.libraryStarted: true +181ms
  muse [WS => Shard 0] [HeartbeatTimer] Sending a heartbeat. +41s
  muse [WS => Shard 0] Heartbeat acknowledged, latency of 101ms. +101ms
Quinten0508 commented 2 years ago

Found that yarn start --verbose displays a few more details (censored tokens/links/session id):

 prisma:client:libraryEngine sending request, this.libraryStarted: true +10ms
  superagent POST https://accounts.spotify.com/api/token +0ms
⠋ 📡 connecting to Discord...  muse Provided token: token_here +57ms
  muse Preparing to connect to the gateway... +0ms
  muse No files needed to be evicted. Total size of the cache is currently 0 bytes, and the cache limit is 2000000000 bytes. +19ms
  superagent POST https://accounts.spotify.com/api/token -> 200 +77ms
⠹ 📡 connecting to Discord...  muse [WS => Manager] Fetched Gateway Information
  muse     URL: wss://gateway.discord.gg
  muse     Recommended Shards: 1 +197ms
  muse [WS => Manager] Session Limit Information
  muse     Total: 1000
  muse     Remaining: 992 +1ms
  muse [WS => Manager] Spawning shards: 0 +0ms
  muse [WS => Shard 0] [CONNECT]
  muse     Gateway    : wss://gateway.discord.gg/
  muse     Version    : 9
  muse     Encoding   : json
  muse     Compression: none +3ms
  muse [WS => Shard 0] Setting a HELLO timeout for 20s. +1ms
⠼ 📡 connecting to Discord...  muse [WS => Shard 0] [CONNECTED] Took 171ms +171ms
  muse [WS => Shard 0] Clearing the HELLO timeout. +5ms
  muse [WS => Shard 0] Setting a heartbeat interval for 41250ms. +0ms
  muse [WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 12929 +1ms
⠧ 📡 connecting to Discord...  muse [WS => Shard 0] [READY] Session session_id(?)_here. +233ms
  muse [WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat. +1ms
  muse [WS => Shard 0] Shard received all its guilds. Marking as fully ready. +28ms
  muse --------------------------------------------------
  muse Core Dependencies
  muse - @discordjs/voice: 0.7.4
  muse - prism-media: 1.3.2
  muse
  muse Opus Libraries
  muse - @discordjs/opus: 0.7.0
  muse - opusscript: not found
  muse
  muse Encryption Libraries
  muse - sodium: not found
  muse - libsodium-wrappers: 0.7.9
  muse - tweetnacl: not found
  muse
  muse FFmpeg
  muse - version: 4.2.4-1ubuntu0.1
  muse - libopus: yes
  muse -------------------------------------------------- +9ms
✔ Ready! Invite the bot with https://discordapp.com/oauth2/authorize?client_id=client_id_here&scope=bot&permissions=36752448

Issuing a command to the bot in the discord server does not give any extra output, same as previous comment.

codetheweb commented 2 years ago

If DEBUG=* is set (looks like it is) then any errors will be logged. I guess something is silently failing somewhere.

There might be bad values in the cache; can you pull and run yarn cache:clear-key-value (just added that script) and then see if anything changes?

Quinten0508 commented 2 years ago

I already tried the built in yarn cache clear without any success. pulled the two files, seems like the path to the .js file is absolute and doesn't work with my setup?

ubuntu@ubuntu:~/muse$ yarn cache:clear-key-value
yarn run v1.22.15
$ npm run env:set-database-url node dist/src/scripts/cache-clear-key-value.js

> muse@0.3.1 env:set-database-url
> node dist/src/scripts/run-with-database-url.js "node" "dist/src/scripts/cache-clear-key-value.js"

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/home/ubuntu/muse/dist/src/scripts/cache-clear-key-value.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
file:///home/ubuntu/muse/node_modules/execa/lib/error.js:59
                error = new Error(message);
                        ^

Error: Command failed with exit code 1: node dist/src/scripts/cache-clear-key-value.js
    at makeError (file:///home/ubuntu/muse/node_modules/execa/lib/error.js:59:11)
    at handlePromise (file:///home/ubuntu/muse/node_modules/execa/index.js:119:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///home/ubuntu/muse/dist/src/scripts/run-with-database-url.js:6:5 {
  shortMessage: 'Command failed with exit code 1: node dist/src/scripts/cache-clear-key-value.js',
  command: 'node dist/src/scripts/cache-clear-key-value.js',
  escapedCommand: 'node "dist/src/scripts/cache-clear-key-value.js"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
codetheweb commented 2 years ago

yarn cache clear refers to Yarn's cache, whereas the script I added deals with Muse's caching of API responses from YouTube and Spotify.

Should have clarified that you need to run yarn build / yarn build:watch before running yarn cache:clear-key-value.

Quinten0508 commented 2 years ago

Ahh, gotcha, just ran yarn cache:clear-key-value:

ubuntu@ubuntu:~/muse$ yarn cache:clear-key-value
yarn run v1.22.15
$ npm run env:set-database-url node dist/src/scripts/cache-clear-key-value.js

> muse@0.3.1 env:set-database-url
> node dist/src/scripts/run-with-database-url.js "node" "dist/src/scripts/cache-clear-key-value.js"

  prisma:tryLoadEnv Environment variables loaded from /home/ubuntu/muse/.env +0ms
  prisma:tryLoadEnv Environment variables loaded from /home/ubuntu/muse/.env +11ms
  prisma:client clientVersion: 3.7.0 +0ms
  prisma:client clientEngineType: library +1ms
  prisma:client:libraryEngine internalSetup +0ms
⠋ Clearing key value cache...  prisma:client Prisma Client call: +82ms
  prisma:client prisma.keyValueCache.deleteMany({}) +2ms
  prisma:client Generated request: +0ms
  prisma:client mutation {
  prisma:client   deleteManyKeyValueCache {
  prisma:client     count
  prisma:client   }
  prisma:client }
  prisma:client  +0ms
  prisma:client:libraryEngine sending request, this.libraryStarted: false +86ms
⠙ Clearing key value cache...  prisma:client:libraryEngine Search for Query Engine Library in /home/ubuntu/muse/node_modules/.prisma/client +99ms
  prisma:client:libraryEngine loadEngine using /home/ubuntu/muse/node_modules/.prisma/client/libquery_engine-linux-arm64-openssl-1.1.x.so.node +1ms
  prisma:client:libraryEngine library starting +12ms
  prisma:client:libraryEngine library started +24ms
✔ Key value cache cleared.
  prisma:client:libraryEngine hookProcess received: beforeExit +6ms
  prisma:client:libraryEngine runBeforeExit +0ms
  prisma:client:libraryEngine hookProcess received: exit +1ms
Done in 2.97s.

Running yarn start and then trying the play command again doesn't change anything. Sorry for not clarifying earlier: DEBUG=* is still set, yes.

codetheweb commented 2 years ago

Not really sure what could be going on at this point. If nothing is being logged then something is silently failing but I don't see where that would be happening.

Has Muse ever worked for you?

Maybe some of the APIs are locked to specific regions. Are you in North America?

Quinten0508 commented 2 years ago

Muse has never worked for me, no. I'm in Europe. I can try running it in a docker container on a (non arm) windows machine in a bit to see if that helps.

Spotify and discord definitely aren't region locked, used them before. I don't see why google cloud would be either.

Quinten0508 commented 2 years ago

Update: Just finished setting up Docker on my Windows desktop, using WSL2 if that matters. Guess what: exact same problem. At this point I'm starting to think it's my home network or isp blocking some traffic?

Got Wireshark, when I use ?play cool song, these two packets are sent:

463 16.238452   192.168.1.20    www.googleapis.com  TCP 54  32892 → https(443) [RST, ACK] Seq=1075 Ack=1957 Win=0 Len=0
465 16.240693   www.googleapis.com  192.168.1.20    TCP 60  https(443) → 32892 [RST] Seq=1957 Win=0 Len=0

192.168.1.20 is my computer's local ip, googleapis should speak for itself. I can provide the csv or yaml files for each packet too if you want them

Quinten0508 commented 2 years ago

Running Muse without Docker on my Windows machine to see if that differs, but yarn build errors out:

C:\Users\Quint\muse>yarn build
yarn run v1.22.17
$ tsc
src/commands/shortcuts.ts:45:37 - error TS7006: Parameter 'accum' implicitly has an 'any' type.

45       const res = shortcuts.reduce((accum, shortcut) => {
                                       ~~~~~

src/commands/shortcuts.ts:45:44 - error TS7006: Parameter 'shortcut' implicitly has an 'any' type.

45       const res = shortcuts.reduce((accum, shortcut) => {
                                              ~~~~~~~~

src/scripts/migrate-and-start.ts:35:33 - error TS2339: Property 'Prisma' does not exist on type 'typeof import("C:/Users/Quint/muse/node_modules/@prisma/client/index")'.

35     if (error instanceof Prisma.Prisma.PrismaClientKnownRequestError && error.code === 'P2010') {
                                   ~~~~~~

src/scripts/migrate-and-start.ts:35:73 - error TS2571: Object is of type 'unknown'.

35     if (error instanceof Prisma.Prisma.PrismaClientKnownRequestError && error.code === 'P2010') {
                                                                           ~~~~~

src/services/file-cache.ts:9:9 - error TS2305: Module '"@prisma/client"' has no exported member 'FileCache'.

9 import {FileCache} from '@prisma/client';
          ~~~~~~~~~

Found 5 errors.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Unsure if this is related, just trying all different possible combos to see if it makes a difference

codetheweb commented 2 years ago

At this point I'm starting to think it's my home network or isp blocking some traffic?

Are you able to try using some kind of cellular hotspot to rule out your local network? I suppose it might be "silently" failing if network calls are timing out but Muse is exited before the default throw-if-timeout period.

Running Muse without Docker on my Windows machine to see if that differs, but yarn build errors out:

You might need to run yarn prisma generate.

Quinten0508 commented 2 years ago

I tried it with mobile data using android usb tethering and tried a vpn, no success. How long is the default throw-if-timeout period?

Running yarn prisma generate works, and so does yarn build, but now yarn start fails:

PS C:\Users\Quint\muse> yarn start
yarn run v1.22.17
$ npm run env:set-database-url -- node --experimental-json-modules dist/src/scripts/migrate-and-start.js

> muse@0.3.1 env:set-database-url
> node dist/src/scripts/run-with-database-url.js "node" "--experimental-json-modules" "dist/src/scripts/migrate-and-start.js"

(node:20668) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
  prisma:tryLoadEnv Environment variables loaded from C:\Users\Quint\muse\.env +0ms
  prisma:tryLoadEnv Environment variables loaded from C:\Users\Quint\muse\.env +311ms
  prisma:client clientVersion: 3.7.0 +0ms
  prisma:client clientEngineType: library +0ms
  prisma:client:libraryEngine internalSetup +0ms
  prisma:tryLoadEnv Environment variables loaded from C:\Users\Quint\muse\.env +239ms
  prisma:client clientVersion: 3.7.0 +238ms
  prisma:client clientEngineType: library +0ms
  prisma:client:libraryEngine internalSetup +238ms
========================================
========================================
================= muse =================
========================================
=========== Made with 🎶 by ============
==== https://github.com/codetheweb =====
========================================
========================================

Running version 0.3.1 built on unknown date (commit unknown)

🔧 Need help? https://github.com/codetheweb/muse/discussions/new
🐛 Bug? https://github.com/codetheweb/muse/issues/new
✨ New feature? https://github.com/codetheweb/muse/issues/new
☕ Discussion? https://github.com/codetheweb/muse/discussions/new
💰 Help me? https://www.paypal.me/codetheweb https://github.com/sponsors/codetheweb

⠋ Applying database migrations...  prisma:client:libraryEngine Search for Query Engine Library in C:\Users\Quint\muse\node_modules\.prisma\client +10ms
  prisma:client:libraryEngine Search for Query Engine Library in C:\Users\Quint\muse\node_modules\.prisma\client +0ms
  prisma:client:libraryEngine loadEngine using C:\Users\Quint\muse\node_modules\.prisma\client\query_engine-windows.dll.node +1ms
  prisma:client:libraryEngine loadEngine using C:\Users\Quint\muse\node_modules\.prisma\client\query_engine-windows.dll.node +6ms
✖ Failed to apply database migrations:
2022-01-08T21:33:21.352Z prisma:loadEnv project root found at C:\Users\Quint\muse\package.json
2022-01-08T21:33:21.365Z prisma:tryLoadEnv Environment variables loaded from C:\Users\Quint\muse\.env
2022-01-08T21:33:21.368Z prisma:engines binaries to download libquery-engine, migration-engine, introspection-engine, prisma-fmt
2022-01-08T21:33:21.657Z prisma:getConfig Using CLI Query Engine (Node-API Library) at: C:\Users\Quint\muse\node_modules\@prisma\engines\query_engine-windows.dll.node
2022-01-08T21:33:21.662Z prisma:getConfig Using CLI Query Engine (Node-API Library) at: C:\Users\Quint\muse\node_modules\@prisma\engines\query_engine-windows.dll.node
Error: Error: P1012: error: Error validating: This line is not a valid definition within a datasource.
  -->  schema.prisma:4
   |
 3 |                 provider = "sqlite"
 4 |                 url = "file:C:\Users\Quint\muse\data/db.sqlite"
 5 |             }
   |

    at createDatabase (C:\Users\Quint\muse\node_modules\prisma\build\index.js:46942:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ensureDatabaseExists (C:\Users\Quint\muse\node_modules\prisma\build\index.js:102138:9)
    at async Object.parse (C:\Users\Quint\muse\node_modules\prisma\build\index.js:103332:28)
    at async main (C:\Users\Quint\muse\node_modules\prisma\build\index.js:106430:18)
  prisma:client:libraryEngine hookProcess received: exit +959ms
  prisma:client:libraryEngine runBeforeExit +0ms
file:///C:/Users/Quint/muse/node_modules/execa/lib/error.js:59
                error = new Error(message);
                        ^

Error: Command failed with exit code 1: node --experimental-json-modules dist/src/scripts/migrate-and-start.js
    at makeError (file:///C:/Users/Quint/muse/node_modules/execa/lib/error.js:59:11)
    at handlePromise (file:///C:/Users/Quint/muse/node_modules/execa/index.js:119:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///C:/Users/Quint/muse/dist/src/scripts/run-with-database-url.js:6:5 {
  shortMessage: 'Command failed with exit code 1: node --experimental-json-modules dist/src/scripts/migrate-and-start.js',
  command: 'node --experimental-json-modules dist/src/scripts/migrate-and-start.js',
  escapedCommand: 'node --experimental-json-modules "dist/src/scripts/migrate-and-start.js"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I checked my router, no firewall/protection of any kind is active there. I disabled uwf on my pi as well just to test, didn't work. Last thing I can do is rent a vultr vps or something like it just to see if that does anything, but I don't expect anything.

codetheweb commented 2 years ago

Running yarn prisma generate works, and so does yarn build, but now yarn start fails:

Whoops, forgot to use path.join() so database path generation works on Windows. Fixed in 21c9dee.

How long is the default throw-if-timeout period?

Would have to do some digging to find out (set by the API wrapper packages Muse uses rather than in Muse's codebase) but I doubt it's longer than 5 minutes.

codetheweb commented 2 years ago

@Quinten0508 were you ever able to make any headway on this?

Quinten0508 commented 2 years ago

Sorry, I've been extremely busy over the last few days. I've completely reinstalled muse w/o Docker on my windows machine just for good measure.

Same error is still given upon running yarn start:

PS C:\Users\Quint\muse> yarn start
yarn run v1.22.17
$ npm run env:set-database-url -- node --experimental-json-modules dist/src/scripts/migrate-and-start.js

> muse@0.5.0 env:set-database-url
> node dist/src/scripts/run-with-database-url.js "node" "--experimental-json-modules" "dist/src/scripts/migrate-and-start.js"

(node:2384) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
  prisma:tryLoadEnv Environment variables loaded from C:\Users\Quint\muse\.env +0ms
  prisma:tryLoadEnv Environment variables loaded from C:\Users\Quint\muse\.env +363ms
  prisma:client clientVersion: 3.7.0 +0ms
  prisma:client clientEngineType: library +0ms
  prisma:client:libraryEngine internalSetup +0ms
  prisma:tryLoadEnv Environment variables loaded from C:\Users\Quint\muse\.env +301ms
  prisma:client clientVersion: 3.7.0 +300ms
  prisma:client clientEngineType: library +0ms
  prisma:client:libraryEngine internalSetup +300ms
========================================
========================================
================= muse =================
========================================
=========== Made with 🎶 by ============
==== https://github.com/codetheweb =====
========================================
========================================

Running version 0.5.0 built on unknown date (commit unknown)

🔧 Need help? https://github.com/codetheweb/muse/discussions/new
🐛 Bug? https://github.com/codetheweb/muse/issues/new
✨ New feature? https://github.com/codetheweb/muse/issues/new
☕ Discussion? https://github.com/codetheweb/muse/discussions/new
💰 Help me? https://www.paypal.me/codetheweb https://github.com/sponsors/codetheweb

⠋ Applying database migrations...  prisma:client:libraryEngine Search for Query Engine Library in C:\Users\Quint\muse\node_modules\.prisma\client +11ms
  prisma:client:libraryEngine Search for Query Engine Library in C:\Users\Quint\muse\node_modules\.prisma\client +0ms
  prisma:client:libraryEngine loadEngine using C:\Users\Quint\muse\node_modules\.prisma\client\query_engine-windows.dll.node +1ms
  prisma:client:libraryEngine loadEngine using C:\Users\Quint\muse\node_modules\.prisma\client\query_engine-windows.dll.node +7ms
✖ Failed to apply database migrations:
2022-01-25T16:11:15.411Z prisma:loadEnv project root found at C:\Users\Quint\muse\package.json
2022-01-25T16:11:15.423Z prisma:tryLoadEnv Environment variables loaded from C:\Users\Quint\muse\.env
2022-01-25T16:11:15.427Z prisma:engines binaries to download libquery-engine, migration-engine, introspection-engine, prisma-fmt
2022-01-25T16:11:15.707Z prisma:getConfig Using CLI Query Engine (Node-API Library) at: C:\Users\Quint\muse\node_modules\@prisma\engines\query_engine-windows.dll.node
2022-01-25T16:11:15.712Z prisma:getConfig Using CLI Query Engine (Node-API Library) at: C:\Users\Quint\muse\node_modules\@prisma\engines\query_engine-windows.dll.node
Error: Error: P1012: error: Error validating: This line is not a valid definition within a datasource.
  -->  schema.prisma:4
   |
 3 |                 provider = "sqlite"
 4 |                 url = "file:C:\Users\Quint\muse\data\db.sqlite"
 5 |             }
   |

    at createDatabase (C:\Users\Quint\muse\node_modules\prisma\build\index.js:46942:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async ensureDatabaseExists (C:\Users\Quint\muse\node_modules\prisma\build\index.js:102138:9)
    at async Object.parse (C:\Users\Quint\muse\node_modules\prisma\build\index.js:103332:28)
    at async main (C:\Users\Quint\muse\node_modules\prisma\build\index.js:106430:18)
  prisma:client:libraryEngine hookProcess received: exit +972ms
  prisma:client:libraryEngine runBeforeExit +0ms
file:///C:/Users/Quint/muse/node_modules/execa/lib/error.js:59
                error = new Error(message);
                        ^

Error: Command failed with exit code 1: node --experimental-json-modules dist/src/scripts/migrate-and-start.js
    at makeError (file:///C:/Users/Quint/muse/node_modules/execa/lib/error.js:59:11)
    at handlePromise (file:///C:/Users/Quint/muse/node_modules/execa/index.js:119:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///C:/Users/Quint/muse/dist/src/scripts/run-with-database-url.js:6:5 {
  shortMessage: 'Command failed with exit code 1: node --experimental-json-modules dist/src/scripts/migrate-and-start.js',
  command: 'node --experimental-json-modules dist/src/scripts/migrate-and-start.js',
  escapedCommand: 'node --experimental-json-modules "dist/src/scripts/migrate-and-start.js"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Perhaps it is the forward slash in the 2nd line here:

 3 |                 provider = "sqlite"
 4 |                 url = "file:C:\Users\Quint\muse\data/db.sqlite"

Windows usually only accepts backslashes "\" for paths and is very picky about what it accepts as a valid path. Interestingly, when I try to cd into the data directory that contains db.sqlite (as mentioned in the above snippet): cd : Cannot find path 'C:\Users\Quint\muse\data' because it does not exist..

Please also note that I don't have sqlite installed on my machine.

codetheweb commented 2 years ago

Perhaps it is the forward slash in the 2nd line here:

Did you modify this file at some point? It should look like

...
datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")
}
...

Please also note that I don't have sqlite installed on my machine.

It's installed via Yarn / NPM, so you don't need to worry about that.

Quinten0508 commented 2 years ago

Didn't modify any files, I completely removed the /muse directory and started over yesterday, so there's no chance it could've been changed. These are all the directories and files currently in /muse. Notice there is no /data folder. Scanning for a db.sqlite file reveals no such file exists on my entire pc even. What exact file are you talking about? image

codetheweb commented 2 years ago

Sorry, my bad--didn't scroll down in your log. (I was referencing schema.prisma.)

There doesn't seem to be an easy fix for it: https://github.com/prisma/prisma/issues/6472.

I would recommend running within Docker if possible, but I know Docker on Windows can be a little finicky.

Quinten0508 commented 2 years ago

I'm starting up a Docker container on my Windows machine now, running with WSL2 enabled inside of Docker. I don't have an x86 Linux machine at the moment.

The containerized bot does seem to "work" - as in it gets up and running and when I invite it to a server it gives the appropriate dm questions. I then joined a random public vc in the server, and asked the bot the default rick-roll play command, to which it replies:

u betcha (edited)
🚫 request failed with status code 400

Edit: I cannot seem to find the logs, the Docker dashboard gui does have a "logs" option for each container, but muse's one is completely empty.

Quinten0508 commented 2 years ago

Trying to play a song w/ Spotify gives 🚫 no songs found - although having checked spotify's developer dashboard, the bot has been making requests during all this time.

Using the search function gives the same result as using a youtube link.

codetheweb commented 2 years ago

Hmm, does it give more info if you set DEBUG=* again?

Quinten0508 commented 2 years ago

Spun up another x86 intel machine w/ debian 11 and a fresh install of docker, installed npm and ran the command listed, still does not seem to work although I am getting past the "applying database migrations" step now"

yarn run v1.22.15
$ npm run env:set-database-url -- node --experimental-json-modules dist/scripts/migrate-and-start.js

> muse@1.1.1 env:set-database-url
> node dist/scripts/run-with-database-url.js "node" "--experimental-json-modules" "dist/scripts/migrate-and-start.js"

========================================
========================================
================= muse =================
========================================
=========== Made with 🎶 by ============
==== https://github.com/codetheweb =====
========================================
========================================

Running version 1.1.1 built on Invalid Date (commit unknown)

🔧 Need help? https://github.com/codetheweb/muse/discussions/new
🐛 Bug? https://github.com/codetheweb/muse/issues/new
✨ New feature? https://github.com/codetheweb/muse/issues/new
☕ Discussion? https://github.com/codetheweb/muse/discussions/new
💰 Help me? https://www.paypal.me/codetheweb https://github.com/sponsors/codetheweb

✔ Database migrations applied.
⠏ 📡 updating commands in all guilds...file:///usr/app/node_modules/@discordjs/rest/dist/index.mjs:7
`)),q){let S=!u(this,c);S&&(g(this,c,new se),u(this,c).wait(),u(this,w).shift()),u(this,b)?.resolve(),g(this,b,null),await W(q,void 0,{ref:!1});let O,ie=new Promise(re=>O=re);g(this,b,{promise:ie,resolve:O}),S&&(await u(this,w).wait(),g(this,k,!0))}return this.runRequest(e,t,s,i,r)}else if(o.status>=500&&o.status<600){if(r!==this.manager.options.retries)return this.runRequest(e,t,s,i,++r);throw new B(o.statusText,o.constructor.name,o.status,a,t,i)}else{if(o.status>=400&&o.status<500){o.status===401&&this.manager.setToken(null);let p=await M(o);throw new D(p,"code"in p?p.code:p.error,o.status,a,t,i)}return null}}};w=new WeakMap,c=new WeakMap,b=new WeakMap,k=new WeakMap;var K=(r=>(r.Delete="delete",r.Get="get",r.Patch="patch",r.Post="post",r.Put="put",r))(K||{}),I,G=class extends ge{constructor(e){super();l(this,"globalRemaining");l(this,"globalDelay",null);l(this,"globalReset",-1);l(this,"hashes",new U);l(this,"handlers",new U);L(this,I,null);l(this,"hashTimer");l(this,"handlerTimer");l(this,"agent",null);l(this,"options");this.options={...x,...e},this.options.offset=Math.max(0,this.options.offset),this.globalRemaining=this.options.globalRequestsPerSecond,this.setupSweepers()}setupSweepers(){let e=t=>{if(t>144e5)throw new Error("Cannot set an interval greater than 4 hours")};this.options.hashSweepInterval!==0&&this.options.hashSweepInterval!==1/0&&(e(this.options.hashSweepInterval),this.hashTimer=setInterval(()=>{let t=new U,s=Date.now();this.hashes.sweep((i,r)=>{if(i.lastAccess===-1)return!1;let a=Math.floor(s-i.lastAccess)>this.options.hashLifetime;return a&&t.set(r,i),this.emit("restDebug",`Hash ${i.value} for ${r} swept due to lifetime being exceeded`),a}),this.emit("hashSweep",t)},this.options.hashSweepInterval).unref()),this.options.handlerSweepInterval!==0&&this.options.handlerSweepInterval!==1/0&&(e(this.options.handlerSweepInterval),this.handlerTimer=setInterval(()=>{let t=new U;this.handlers.sweep((s,i)=>{let{inactive:r}=s;return r&&t.set(i,s),this.emit("restDebug",`Handler ${s.id} for ${i} swept due to being inactive`),r}),this.emit("handlerSweep",t)},this.options.handlerSweepInterval).unref())}setToken(e){return g(this,I,e),this}async queueRequest(e){let t=G.generateRouteData(e.fullRoute,e.method),s=this.hashes.get(`${e.method}:${t.bucketRoute}`)??{value:`Global(${e.method}:${t.bucketRoute})`,lastAccess:-1},i=this.handlers.get(`${s.value}:${t.majorParameter}`)??this.createHandler(s.value,t.majorParameter),{url:r,fetchOptions:a}=this.resolveRequest(e);return i.queueRequest(t,r,a,{body:e.body,files:e.files})}createHandler(e,t){let s=new C(this,e,t);return this.handlers.set(s.id,s),s}resolveRequest(e){let{options:t}=this;this.agent??=t.api.startsWith("https")?new fe({...t.agent,keepAlive:!0}):new Re({...t.agent,keepAlive:!0});let s="";if(e.query){let o=e.query.toString();o!==""&&(s=`?${o}`)}let i={...this.options.headers,"User-Agent":`${Y} ${t.userAgentAppendix}`.trim()};if(e.auth!==!1){if(!u(this,I))throw new Error("Expected token to be set for this request, but none was present");i.Authorization=`${e.authPrefix??"Bot"} ${u(this,I)}`}e.reason?.length&&(i["X-Audit-Log-Reason"]=encodeURIComponent(e.reason));let r=`${t.api}${e.versioned===!1?"":`/v${t.version}`}${e.fullRoute}${s}`,a,m={};if(e.files?.length){let o=new he;for(let[d,y]of e.files.entries())o.append(y.key??`files[${d}]`,y.fileData,y.fileName);if(e.body!=null)if(e.appendToFormData)for(let[d,y]of Object.entries(e.body))o.append(d,y);else o.append("payload_json",JSON.stringify(e.body));a=o,m=o.getHeaders()}else e.body!=null&&(e.passThroughBody?a=e.body:(a=JSON.stringify(e.body),m={"Content-Type":"application/json"}));let E={agent:this.agent,body:a,headers:{...e.headers??{},...m,...i},method:e.method};return{url:r,fetchOptions:E}}clearHashSweeper(){clearInterval(this.hashTimer)}clearHandlerSweeper(){clearInterval(this.handlerTimer)}static generateRouteData(e,t){let i=/^\/(?:channels|guilds|webhooks)\/(\d{16,19})/.exec(e)?.[1]??"global",r=e.replace(/\d{16,19}/g,":id").replace(/\/reactions\/(.*)/,"/reactions/:reaction"),a="";if(t==="delete"&&r==="/channels/:id/messages/:id"){let m=/\d{16,19}$/.exec(e)[0],E=de.deconstruct(m);Date.now()-Number(E.timestamp)>1e3*60*60*24*14&&(a+="/Delete Old Message")}return{majorParameter:i,bucketRoute:r+a,original:e}}},F=G;I=new WeakMap;import{EventEmitter as be}from"node:events";var ye=class extends be{constructor(e={}){super();l(this,"cdn");l(this,"requestManager");this.cdn=new N(e.cdn??x.cdn),this.requestManager=new F(e).on("restDebug",this.emit.bind(this,"restDebug")).on("rateLimited",this.emit.bind(this,"rateLimited")).on("invalidRequestWarning",this.emit.bind(this,"invalidRequestWarning")).on("hashSweep",this.emit.bind(this,"hashSweep")),this.on("newListener",(t,s)=>{(t==="request"||t==="response")&&this.requestManager.on(t,s)}),this.on("removeListener",(t,s)=>{(t==="request"||t==="response")&&this.requestManager.off(t,s)})}setToken(e){return this.requestManager.setToken(e),this}get(e,t={}){return this.request({...t,fullRoute:e,method:"get"})}delete(e,t={}){return this.request({...t,fullRoute:e,method:"delete"})}post(e,t={}){return this.request({...t,fullRoute:e,method:"post"})}put(e,t={}){return this.request({...t,fullRoute:e,method:"put"})}patch(e,t={}){return this.request({...t,fullRoute:e,method:"patch"})}request(e){return this.requestManager.queueRequest(e)}};export{ee as ALLOWED_EXTENSIONS,_ as ALLOWED_SIZES,te as ALLOWED_STICKER_EXTENSIONS,N as CDN,x as DefaultRestOptions,Y as DefaultUserAgent,D as DiscordAPIError,B as HTTPError,ye as REST,j as RESTEvents,A as RateLimitError,F as RequestManager,K as RequestMethod};
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ^

D[50001]: Missing Access
    at C.runRequest (file:///usr/app/node_modules/@discordjs/rest/dist/index.mjs:7:557)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async C.queueRequest (file:///usr/app/node_modules/@discordjs/rest/dist/index.mjs:5:3022)
    at async file:///usr/app/dist/bot.js:126:25
    at async Promise.all (index 0)
    at async Client.<anonymous> (file:///usr/app/dist/bot.js:124:17) {
  rawError: { message: 'Missing Access', code: 50001 },
  code: 50001,
  status: 403,
  method: 'put',
  url: 'https://discord.com/api/v9/applications/928282471668273153/guilds/713796245793144883/commands',
  requestBody: {
    files: undefined,
    json: [
      {
        name: 'clear',
        description: 'clears all songs in queue except currently playing song',
        options: [],
        default_permission: undefined
      },
      {
        name: 'config',
        description: 'configure bot settings',
        options: [
          {
            type: 1,
            name: 'set-playlist-limit',
            description: 'set the maximum number of tracks that can be added from a playlist',
            options: [Array]
          },
          {
            type: 1,
            name: 'set-role',
            description: 'set the role that is allowed to use the bot',
            options: [Array]
          },
          {
            type: 1,
            name: 'set-wait-after-queue-empties',
            description: 'set the time to wait before leaving the voice channel when queue empties',
            options: [Array]
          },
          {
            type: 1,
            name: 'set-leave-if-no-listeners',
            description: 'set whether to leave when all other participants leave',
            options: [Array]
          },
          {
            type: 1,
            name: 'get',
            description: 'show all settings',
            options: []
          }
        ],
        default_permission: undefined
      },
      {
        name: 'disconnect',
        description: 'pause and disconnect Muse',
        options: [],
        default_permission: undefined
      },
      {
        name: 'favorites',
        description: 'add a song to your favorites',
        options: [
          {
            type: 1,
            name: 'use',
            description: 'use a favorite',
            options: [Array]
          },
          {
            type: 1,
            name: 'list',
            description: 'list all favorites',
            options: []
          },
          {
            type: 1,
            name: 'create',
            description: 'create a new favorite',
            options: [Array]
          },
          {
            type: 1,
            name: 'remove',
            description: 'remove a favorite',
            options: [Array]
          }
        ],
        default_permission: undefined
      },
      {
        name: 'fseek',
        description: 'seek forward in the current song',
        options: [
          {
            max_value: undefined,
            min_value: undefined,
            choices: undefined,
            autocomplete: undefined,
            type: 10,
            name: 'seconds',
            description: 'the number of seconds to skip forward',
            required: true
          }
        ],
        default_permission: undefined
      },
      {
        name: 'pause',
        description: 'pause the current song',
        options: [],
        default_permission: undefined
      },
      {
        name: 'play',
        description: 'play a song or resume playback',
        options: [
          {
            choices: undefined,
            autocomplete: true,
            type: 3,
            name: 'query',
            description: 'YouTube URL, Spotify URL, or search query',
            required: false
          },
          {
            name: 'immediate',
            description: 'add track to the front of the queue',
            required: false,
            type: 5
          },
          {
            name: 'shuffle',
            description: "shuffle the input if you're adding multiple tracks",
            required: false,
            type: 5
          }
        ],
        default_permission: undefined
      },
      {
        name: 'queue',
        description: 'show the current queue',
        options: [
          {
            max_value: undefined,
            min_value: undefined,
            choices: undefined,
            autocomplete: undefined,
            type: 4,
            name: 'page',
            description: 'page of queue to show [default: 1]',
            required: false
          }
        ],
        default_permission: undefined
      },
      {
        name: 'remove',
        description: 'remove songs from the queue',
        options: [
          {
            max_value: undefined,
            min_value: undefined,
            choices: undefined,
            autocomplete: undefined,
            type: 4,
            name: 'position',
            description: 'position of the song to remove [default: 1]',
            required: false
          },
          {
            max_value: undefined,
            min_value: undefined,
            choices: undefined,
            autocomplete: undefined,
            type: 4,
            name: 'range',
            description: 'number of songs to remove [default: 1]',
            required: false
          }
        ],
        default_permission: undefined
      },
      {
        name: 'seek',
        description: 'seek to a position from beginning of song',
        options: [
          {
            choices: undefined,
            autocomplete: undefined,
            type: 3,
            name: 'time',
            description: 'time to seek',
            required: true
          }
        ],
        default_permission: undefined
      },
      {
        name: 'shuffle',
        description: 'shuffle the current queue',
        options: [],
        default_permission: undefined
      },
      {
        name: 'skip',
        description: 'skip the next songs',
        options: [
          {
            max_value: undefined,
            min_value: undefined,
            choices: undefined,
            autocomplete: undefined,
            type: 4,
            name: 'number',
            description: 'number of songs to skip [default: 1]',
            required: false
          }
        ],
        default_permission: undefined
      },
      {
        name: 'unskip',
        description: 'go back in the queue by one song',
        options: [],
        default_permission: undefined
      }
    ]
  }
}
file:///usr/app/node_modules/execa/lib/error.js:59
        error = new Error(message);
                ^

Error: Command failed with exit code 1: node --experimental-json-modules dist/scripts/migrate-and-start.js
    at makeError (file:///usr/app/node_modules/execa/lib/error.js:59:11)
    at handlePromise (file:///usr/app/node_modules/execa/index.js:119:26)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async file:///usr/app/dist/scripts/run-with-database-url.js:5:5 {
  shortMessage: 'Command failed with exit code 1: node --experimental-json-modules dist/scripts/migrate-and-start.js',
  command: 'node --experimental-json-modules dist/scripts/migrate-and-start.js',
  escapedCommand: 'node --experimental-json-modules "dist/scripts/migrate-and-start.js"',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: undefined,
  stderr: undefined,
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}
npm notice 
npm notice New minor version of npm available! 8.1.0 -> 8.5.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.5.0
npm notice Run npm install -g npm@8.5.0 to update!
npm notice 
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Quinten0508 commented 2 years ago

Got it to work by kicking my bot from all servers, then re-running the server. However, using a youtube URL or search query gives 🚫 ope: Request failed with status code 403 and using a spotify URL gives 🚫 ope: no songs found. Portainer's logs do not show anything. Will try again w/o docker in a few hrs so I can set DEBUG=*

Quinten0508 commented 2 years ago

Ran Muse with DEBUG=* set in the .env file. This was run w/o docker, still on the same machine (amd64, Debian GNU/Linux 11 (bullseye) x86_64, Intel Celeron 847 (2) @ 1.100GHz, 4GB RAM). Here's a hastebin link, my original comment contained 5x the maximum char count: https://hastebin.nl/nYB4Q0u

codetheweb commented 2 years ago

It looks like all the YouTube queries are returning 403s, so I'd double check your Google API key and make sure it has access to YouTube APIs (check the README for details).

Quinten0508 commented 2 years ago

Right, I created a new project following the README and now it does seem to work! Thank you!

codetheweb commented 2 years ago

Glad you got it working!