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

VoiceConnection#playFile() crashes bot with 'TypeError: Bad argument' #16

Closed
Ratismal opened this issue Jul 6, 2016 · 6 comments
Closed

Comments

@Ratismal
Copy link
Contributor

Ratismal commented Jul 6, 2016

Hi,

I've been trying to make a simple music bot with Eris for learning experience. The objective is to have it join a voice channel, play an existing song file, and leave. Joining and leaving the voice channel has been working, but whenever I attempt to play the song the bot crashes.

Here is the code that I'm executing:

voiceConnections[msg.channel.guild.id].playFile("file.mp3");

where voiceConnections is an object containing VoiceConnection objects mapped to guild IDs, and "file.mp3" is an existing mp3 file.

The bot then crashes with this message:

events.js:141
      throw er; // Unhandled 'error' event
      ^

TypeError: Bad argument
    at TypeError (native)
    at ChildProcess.spawn (internal/child_process.js:274:26)
    at Object.exports.spawn (child_process.js:362:9)
    at VoiceConnection.playStream (c:\Users\user\WebstormProjects\pomfbot\node_modules\eris\lib\core\VoiceConnection.js:307:36)
    at VoiceConnection.playFile (c:\Users\user\WebstormProjects\pomfbot\node_modules\eris\lib\core\VoiceConnection.js:298:14)
    at Client.<anonymous> (c:\Users\user\WebstormProjects\pomfbot\pomf.js:83:56)
    at emitOne (events.js:77:13)
    at Client.emit (events.js:169:7)
    at Shard.wsEvent (c:\Users\user\WebstormProjects\pomfbot\node_modules\eris\lib\core\Shard.js:319:33)
    at WebSocket.<anonymous> (c:\Users\user\WebstormProjects\pomfbot\node_modules\eris\lib\core\Shard.js:953:34)

I know for sure that the issue isn't finding the file, because if I tell it to play a nonexisting file it crashes with an ENOENT error.

I have all the necessary libs, such as node-gyp, node-opus, and ffmpeg. I have installed Eris without the --no-optional tag. I will be more than happy to provide any additional information.

Thank you for your time,
Ratismal

@Ratismal Ratismal changed the title VoiceConnection#playFile() crashes bot VoiceConnection#playFile() crashes bot with 'TypeError: Bad argument' Jul 6, 2016
@davidcole1340
Copy link

Seems like Eris is unable to find your ffmpeg or avconv executable, can you double check FFmpeg is working?

@Ratismal
Copy link
Contributor Author

Ratismal commented Jul 7, 2016

I'm fairly certain that ffmpeg is working, because I run rhino music bot that uses ffmpeg without issue. Here is the console output for when I run ffmpeg:
console output
Do I need both ffmpeg and avconv installed? The docs have no mention of either.

@davidcole1340
Copy link

You only need one installed.

On 8/07/2016, at 5:39 AM, stupid cat notifications@github.com wrote:

I'm fairly certain that ffmpeg is working, because I run rhino music bot https://github.com/SexualRhinoceros/MusicBot that uses ffmpeg without issue. Here is the console output for when I run ffmpeg:
https://camo.githubusercontent.com/9f40fdce7da0945f83f4fd16504396a743567ebb/68747470733a2f2f692e6779617a6f2e636f6d2f64353266623233653135313235316462313562633238353639646533663364382e706e67
Do I need both ffmpeg and avconv installed? The docs https://abal.moe/Eris/docs.html have no mention of either.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub #16 (comment), or mute the thread https://github.com/notifications/unsubscribe/AA8igImfu1jVZwrqSRIt9WgW3DFbRkyLks5qTTnbgaJpZM4JGhQf.

@devsnek
Copy link

devsnek commented Jul 7, 2016

@Ratismal --no-optional installs without optional things like voice

@davidcole1340
Copy link

@GusCaplan He said he installed Eris without the tag, it's worded weird, thought that as well.

@Ratismal
Copy link
Contributor Author

Ratismal commented Jul 7, 2016

I have installed Eris without the --no-optional tag.

Sorry for the confusion.

@hsiW hsiW added the voice label Jan 10, 2017
Brainicism referenced this issue in Brainicism/eris Feb 13, 2023
* fix(voice): re-add receive listener on connect (abalabahaha#1332)

* fix(getAllUsers): request presences if intent is enabled (abalabahaha#1378)

* chore(Base): document props, static methods (abalabahaha#1380)

* fix(Guild#editCommandPermissions): fix alias typo (abalabahaha#1350)

* fix(getGuildAuditLog): cache users & threads earlier (abalabahaha#1367)

* fix(messageUpdate): fix oldMessage#mentions type (abalabahaha#1377)

* fix(joinVoiceChannel): skip permission check if Member uncached (abalabahaha#1383)

Co-authored-by: Donovan Daniels <hewwo@yiff.rocks>

* fix(ShardManager): refactor concurrency check, add option (abalabahaha#1382)

* fix(createRole): split options into separate overloads (abalabahaha#1376)

* feat(getGuildBans): support pagination (abalabahaha#1363)

Co-authored-by: abalabahaha <hi@abal.moe>

* feat(editChannelPositions): add support for endpoint (abalabahaha#1328)

Co-authored-by: bsian03 <chharry321@gmail.com>
Co-authored-by: abalabahaha <hi@abal.moe>

* fix(editChannel): fix `videoQualityMode` & add `permissionOverwrites` (abalabahaha#1319)

* feat(connect): add token check (abalabahaha#1283)

* feat(Client): allow custom numbers in intents option (abalabahaha#1388)

Co-authored-by: Donovan Daniels <hewwo@yiff.rocks>
Co-authored-by: abalabahaha <hi@abal.moe>

* feat(interactions): Add support for appPermissions (abalabahaha#1394)

* fix(Client): remove optional chaining from 05a932a

* 0.17.1

* chore: bump dev version to 0.17.2-dev

* feat(Member): Add dynamicAvatarURL (abalabahaha#1411)

* feat(permissions): Slash Permissions v2 (PR 1372)

* Attachment type (PR 1358)

* Remove all user account features (PR 1338)

* refactor(interactions): Interactions Refactor (PR 1309)

* feat(interactions): Support Modals (PR 1404)

* Use process warnings for deprecations (PR 1276)

* Guild Scheduled Events (PR 1275)

* Follow http/https redirects when playing song (PR 494)

* Return void on 204 (PR 1021)

* Allow configuring RequestHandler to use HTTP instead of HTTPS (PR 1193)

* Standardized parsing errors (PR 1227)

* feat(gateway): Use New Resume URL (PR 1410)

* refactor: remove StoreChannels (PR 1405)

* feat(bans): Seconds Support (PR 1397)

* feat(AutoModeration): Support Auto Moderation (PR 1390)

* feat(options): Gateway Options (PR 1384)

* refactor: Overall Consistency Fixes & Minor Feature Additions (PR 1379)

* fix(CommandClient): await permission checks (PR 1414)

* feat: API v10 (PR 1371)

* chore: rebrand to Project Dysnomia

* lint

* fix: use ./* for exports

* chore: rename forgotten references to Eris (#2)

For the time being, until I figure out what to do with references to Eris' website, appropriate links in code/Discord's API docs have been linked.

* chore: remove deprecated/dead code (#3)

* feat: entity select types (#4)

* chore(examples/intent): fix import typo (#6)

* chore: update example in README.md (#7)

* feat: modern file uploading (#5)

* fixup(Client): oops :( make _processAttachments return the expected structure (#8)

Also do not pass empty file arrays (triggers data being sent over as multipart data)

* feat(automoderation): support new trigger metadata (#9)

* support new trigger metadata types

* update trigger type constants

* deprecate camel-cased trigger metadata, use raw metadata instead

* feat(Constants): add ACTIVE_DEVELOPER user flag (#10)

* feat: forum support (#1)

I believe this should be enough to ensure full forum support. Although, some things might've been missed out by accident.

* Attachment#proxyUrl -> Attachment#proxyURL (#11)

* fix(Client): do not send the file buffer twice (#13)

* feat(Guild): automatically populate events on GUILD_CREATE (#12)

* feat(ForumChannel): `default_forum_layout` (#14)

* chore: update dev dependencies and lint (#15)

* chore: remove editGuildVanity (abalabahaha#18)

* Removed editGuildVanity

The vanity endpoint was disabled for bots

```
{
    "message": "Bots cannot use this endpoint",
    "code": 20001
}
```

* remove Guild#editVanity

* update TSDs appropriately

Co-authored-by: Lars_und_so <46791248+Larsundso@users.noreply.github.com>

* feat(ApplicationCommand): support NSFW commands (#16)

* docs: document audit log after parameter (abalabahaha#20)

ref: discord/discord-api-docs@38f01b0

* fix(Constants): wrong ACTIVE_DEVELOPER bit (╯°□°)╯︵ ┻━┻ (abalabahaha#23)

* feat: add new message types (abalabahaha#22)

* feat: add new message types

currently won't apply any transformations to message content, as I don't know how the messages look like.

ref: discord/discord-api-docs@e9711be
ref: discord/discord-api-docs@83f6c85

* don't do anything special to the messages right now

* feat: add GIF as a supported sticker format (abalabahaha#24)

ref: discord/discord-api-docs@5214f12

* feat: linked roles (abalabahaha#19)

* add role connection verification url into OAuthAppInfo

* Add Client#{edit,get}RoleConnectionMetadata

Interface may be subject to change

* add guild connection role tag

* add role connection metadata type enum

* add types

* feat(ThreadChannel): thread member pagination (abalabahaha#25)

* feat(ThreadChannel): allow fetching more details about thread members

* feat(ThreadChannel): add singular thread member fetching

* remove redundant parameter

* member data from THREAD_MEMBERS_UPDATE is sent in the member field

* handle the guild not being cached accordingly

* consistently transform options in getThreadMember

* feat: role subscriptions (abalabahaha#21)

* basic role subscription implementation

* add role subscription data to Message object

see API docs PR 5828

* align guild features with API docs

* remove TODO comment

roleSubscriptionData will be kept as a camelCased object

* fix(ThreadMember): missing Member import (abalabahaha#27)

* feat(Client): add threadID support to editWebhookMessage (abalabahaha#28)

* fix(Client): add threadID support to editWebhookMessage

* reword doc for threadID

* add threadID doc to Message#editWebhook

* update ts definitions

* fix(ShardManager): correctly emit warning on invalid intent (abalabahaha#29)

* fix(ForumChannel): document and handle nullability of certain fields

---------

Co-authored-by: Jim Chen <10269287+jimchen5209@users.noreply.github.com>
Co-authored-by: EXPLOSION <git@helvetica.moe>
Co-authored-by: Erin <github@eritbh.me>
Co-authored-by: Chris <67835702+NotChris123@users.noreply.github.com>
Co-authored-by: Donovan Daniels <hewwo@yiff.rocks>
Co-authored-by: abal <hi@abal.moe>
Co-authored-by: HeadTriXz <32986761+HeadTriXz@users.noreply.github.com>
Co-authored-by: Carlos Lima <xaxim@users.noreply.github.com>
Co-authored-by: bsian03 <chharry321@gmail.com>
Co-authored-by: isaiah <662614+aicushman@users.noreply.github.com>
Co-authored-by: Catboy <50190590+Catboi8@users.noreply.github.com>
Co-authored-by: HcgRandon <me@randon.moe>
Co-authored-by: F Robinson <freddy@protality.plus.com>
Co-authored-by: Alex <alex.dumbreck@gmail.com>
Co-authored-by: Loliticos <loliticos@outlook.com>
Co-authored-by: macdja38 <jakeincanada@icloud.com>
Co-authored-by: Thijs Molendijk <thijs.molendijk@gmail.com>
Co-authored-by: LJNeon <23249107+LJNeon@users.noreply.github.com>
Co-authored-by: yalpha <44028028+YalphaFR@users.noreply.github.com>
Co-authored-by: TTtie <me@tttie.cz>
Co-authored-by: Sham <thesham@protonmail.com>
Co-authored-by: Lars_und_so <46791248+Larsundso@users.noreply.github.com>
Co-authored-by: Cynthia Foxwell <LUModder@gmail.com>
Co-authored-by: Snazzah <7025343+Snazzah@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants