Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

docs: music-bot example crashing when url is not a link #205

Merged
merged 1 commit into from
Oct 27, 2021
Merged

docs: music-bot example crashing when url is not a link #205

merged 1 commit into from
Oct 27, 2021

Conversation

causztic
Copy link
Contributor

Please describe the changes this PR makes and why it should be merged:

Since play is a deferred command, the example should use followUp instead of reply in the error response. Using reply causes the bot to crash when the error is reached. Here is the stacktrace:

Error: No video id found: boom ba yah
    at Object.exports.getVideoID (/Users/yaojie/Work/bubba/node_modules/ytdl-core/lib/url-utils.js:63:11)
    at exports.<computed> (/Users/yaojie/Work/bubba/node_modules/ytdl-core/lib/info.js:476:29)
    at Function.<anonymous> (/Users/yaojie/Work/bubba/src/music/track.ts:86:33)
    at step (/Users/yaojie/Work/bubba/src/music/track.ts:44:23)
    at Object.next (/Users/yaojie/Work/bubba/src/music/track.ts:25:53)
    at /Users/yaojie/Work/bubba/src/music/track.ts:19:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/yaojie/Work/bubba/src/music/track.ts:15:12)
    at Function.Track.from (/Users/yaojie/Work/bubba/src/music/track.ts:114:16)
    at /Users/yaojie/Work/bubba/index.ts:57:35
/Users/yaojie/Work/bubba/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:89
    if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
                                             ^
Error [INTERACTION_ALREADY_REPLIED]: The reply to this interaction has already been sent or deferred.
    at CommandInteraction.reply (/Users/yaojie/Work/bubba/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:89:46)
    at /Users/yaojie/Work/bubba/index.ts:74:27
    at step (/Users/yaojie/Work/bubba/index.ts:34:23)
    at Object.throw (/Users/yaojie/Work/bubba/index.ts:15:53)
    at rejected (/Users/yaojie/Work/bubba/index.ts:7:65)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  [Symbol(code)]: 'INTERACTION_ALREADY_REPLIED'
}

Status and versioning classification:

Not sure how to classify this as i'm only fixing the example, I guess it's

Code changes have been tested against the Discord API, or there are no code changes

@causztic causztic changed the title Fix music-bot example crashing when url is not a correct link Fix music-bot example crashing when url is not a link Sep 17, 2021
@iCrawl iCrawl changed the title Fix music-bot example crashing when url is not a link docs: music-bot example crashing when url is not a link Oct 27, 2021
@iCrawl iCrawl merged commit b9d1038 into discordjs:main Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants