Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught promise error on !play or !add command #49

Open
ghost opened this issue Sep 14, 2021 · 6 comments
Open

Uncaught promise error on !play or !add command #49

ghost opened this issue Sep 14, 2021 · 6 comments

Comments

@ghost
Copy link

ghost commented Sep 14, 2021

Hi,

Hoping you could help with this, whenever I run npm start, the bot starts correctly but always says "- Can Manage Messages: false" although the permission is granted in the server. Then running either !play or !add will cause the below error and the bot will crash. Using !help or !ping works correctly though.

I haven't done much with typescript before and only very lightly worked with discord bots, so sorry if this is a stupid question, but do you have any ideas on how to fix this?

Thanks!

Full log from console (nothing in bot.log):

> rhythm-bot@2.1.5 start /home/django/django_project/rhythmbot/Rhythm-Bot-2.1.6
> tsc && node dist/app

[2021-09-14T20:51:59.570Z] (debug): Bot Online
Guilds: 1
Guild Name: BotTestArena
- Can Manage Messages: false
[2021-09-14T20:51:59.581Z] (debug): Rhythm Bot Online
[2021-09-14T21:01:09.174Z] (debug): Bot Command: !play https://www.youtube.com/watch?v=duakjBfCMG4
/home/django/django_project/rhythmbot/Rhythm-Bot-2.1.6/node_modules/discord-bot-quickstart/lib/models/bot.model.js:10
process.on('unhandledRejection', error => this.log.error('Uncaught Promise Rejection', error));
                                                   ^

TypeError: Cannot read property 'error' of undefined
    at process.on.error (/home/django/django_project/rhythmbot/Rhythm-Bot-2.1.6/node_modules/discord-bot-quickstart/lib/models/bot.model.js:10:52)
    at process.emit (events.js:198:13)
    at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)
    at process._tickCallback (internal/process/next_tick.js:69:34)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! rhythm-bot@2.1.5 start: `tsc && node dist/app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the rhythm-bot@2.1.5 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-09-14T21_01_09_527Z-debug.log
@ElvisRodriguez
Copy link

I just wanted to add that I'm in the same boat, here are my logs:

2021-09-15T20:34:21.954780+00:00 app[web.1]: Guild Name: debugging-server
2021-09-15T20:34:21.954798+00:00 app[web.1]: - Can Manage Messages: false
2021-09-15T20:34:21.955809+00:00 app[web.1]: [2021-09-15T20:34:21.955Z] (debug): Console Reader Disconnected
2021-09-15T20:34:59.812414+00:00 app[web.1]: [2021-09-15T20:34:59.812Z] (debug): Bot Command: !ping
2021-09-15T20:35:12.138448+00:00 heroku[web.1]: Process exited with status 1
2021-09-15T20:35:12.285184+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-15T20:35:11.975655+00:00 app[web.1]: [2021-09-15T20:35:11.975Z] (debug): Bot Command: !play
2021-09-15T20:35:11.977857+00:00 app[web.1]: /app/node_modules/discord-bot-quickstart/lib/models/bot.model.js:10
2021-09-15T20:35:11.977859+00:00 app[web.1]: process.on('unhandledRejection', error => this.log.error('Uncaught Promise Rejection', error));
2021-09-15T20:35:11.977859+00:00 app[web.1]:                                                    ^
2021-09-15T20:35:11.977860+00:00 app[web.1]: 
2021-09-15T20:35:11.977860+00:00 app[web.1]: TypeError: Cannot read property 'error' of undefined
2021-09-15T20:35:11.977861+00:00 app[web.1]:     at process.<anonymous> (/app/node_modules/discord-bot-quickstart/lib/models/bot.model.js:10:52)
2021-09-15T20:35:11.977861+00:00 app[web.1]:     at process.emit (events.js:400:28)
2021-09-15T20:35:11.977862+00:00 app[web.1]:     at processPromiseRejections (internal/process/promises.js:245:33)
2021-09-15T20:35:11.977862+00:00 app[web.1]:     at processTicksAndRejections (internal/process/task_queues.js:96:32)
2021-09-15T20:35:11.985544+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-09-15T20:35:11.985732+00:00 app[web.1]: npm ERR! errno 1
2021-09-15T20:35:11.988703+00:00 app[web.1]: npm ERR! rhythm-bot@2.1.5 start: `tsc && node dist/app`
2021-09-15T20:35:11.988748+00:00 app[web.1]: npm ERR! Exit status 1
2021-09-15T20:35:11.988808+00:00 app[web.1]: npm ERR! 
2021-09-15T20:35:11.988853+00:00 app[web.1]: npm ERR! Failed at the rhythm-bot@2.1.5 start script.
2021-09-15T20:35:11.988900+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-09-15T20:35:11.994225+00:00 app[web.1]: 
2021-09-15T20:35:11.994325+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-09-15T20:35:11.994373+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2021-09-15T20_35_11_989Z-debug.log

@Malexion
Copy link
Owner

Yeah it's not reading the permission properly even if it's granted it so it always says false, I haven't set aside time to figure it out yet sorry

@Malexion
Copy link
Owner

Updated to hopefully fix the promise error now the error should log to the console

@Malexion
Copy link
Owner

Also the play command only forces the bot to join the channel and play it's current playlist.

!youtube https://www.youtube.com/watch?v=duakjBfCMG4
or
!youtube duakjBfCMG4
then
!play

or you can !search some song

@Malexion
Copy link
Owner

Did the latest commit resolve this error or no?

@ghost
Copy link
Author

ghost commented Sep 26, 2021

So this commit fixed the last issue but has caused another problem, something about uncaught promises with fields.flat and FFmpeg/avconv. Full Log is below, sorry that this doesn't seem to be working!

rhythm-bot@2.1.5 start /home/django/django_project/rhythm/Rhythm-Bot
tsc && node dist/app

[2021-09-26T20:40:20.112Z] (debug): Rhythm Bot Online
[2021-09-26T20:40:20.124Z] (debug): Bot Online
Guilds: 1
Guild Name: BotTestArena

  • Can Manage Messages: false
    [2021-09-26T20:40:24.773Z] (debug): Bot Command: !youtube https://www.youtube.com/watch?v=PpSTwj6Plc8
    Uncaught Promise Rejection TypeError: fields.flat is not a function
    at Function.normalizeFields (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/MessageEmbed.js:450:8)
    at MessageEmbed.setup (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/MessageEmbed.js:78:91)
    at new MessageEmbed (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/MessageEmbed.js:18:10)
    at embedLikes.map.e (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/APIMessage.js:166:40)
    at Array.map ()
    at APIMessage.resolveData (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/APIMessage.js:166:31)
    at TextChannel.send (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62)
    at Promise.then.catch.err (/home/django/django_project/rhythm/Rhythm-Bot/dist/media/media-player.js:51:30)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    [2021-09-26T20:40:31.071Z] (debug): Bot Command: !play
    Uncaught Promise Rejection TypeError: fields.flat is not a function
    at Function.normalizeFields (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/MessageEmbed.js:450:8)
    at MessageEmbed.setup (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/MessageEmbed.js:78:91)
    at new MessageEmbed (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/MessageEmbed.js:18:10)
    at embedLikes.map.e (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/APIMessage.js:166:40)
    at Array.map ()
    at APIMessage.resolveData (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/APIMessage.js:166:31)
    at TextChannel.send (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:166:62)
    at then.conn (/home/django/django_project/rhythm/Rhythm-Bot/dist/bot/bot.js:101:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    Uncaught Promise Rejection Error: FFmpeg/avconv not found!
    at Function.getInfo (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/prism-media/src/core/FFmpeg.js:142:11)
    at Function.create (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/prism-media/src/core/FFmpeg.js:155:38)
    at new FFmpeg (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/prism-media/src/core/FFmpeg.js:44:27)
    at AudioPlayer.playUnknown (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/client/voice/player/BasePlayer.js:47:20)
    at VoiceConnection.play (/home/django/django_project/rhythm/Rhythm-Bot/node_modules/discord.js/src/client/voice/util/PlayInterface.js:71:28)
    at MediaPlayer.dispatchStream (/home/django/django_project/rhythm/Rhythm-Bot/dist/media/media-player.js:78:43)
    at type.getStream.then.stream (/home/django/django_project/rhythm/Rhythm-Bot/dist/media/media-player.js:159:30)
    at process._tickCallback `(internal/process/next_tick.js:68:7)``

I think the actual playing of this is an issue with ffmpeg, I tried installing the latest version with npm but it made no difference unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants