Skip to content

Comments

Partial voice support && CI enchantments#30

Open
cborac wants to merge 57 commits intoAlon-L:masterfrom
cborac:master
Open

Partial voice support && CI enchantments#30
cborac wants to merge 57 commits intoAlon-L:masterfrom
cborac:master

Conversation

@cborac
Copy link
Contributor

@cborac cborac commented Sep 2, 2020

Partial voice support:

  • Bot can join to channels and receive audio (Bot raw PCM and Opus Encoded)
  • Bot can receive and store voice states
    NOTE: User must install opusscript and sodium-native to use it

CI enchantments:

  • New job added (Compile):
    • It will compile the lib on every push and commit it
    • This makes the package install a lot faster since the user wouldn't need to install typescript and compile it on their computer
  • npm run ci:build:
    • This is used by cis to compile the lib (with the option outDir=./lib)
  • npm run build:
    • This is used for local tests it will output to dist folder and git wont track it
      NOTE: Contributors must not commit the changes on the lib file (To avoid stupid merge conflicts)

Optional Dependencies:

  • Added .d.ts files under the types folder, this would solve Variable 'optional package name' implicitly has type 'any' in some locations where its type cannot be determined error on the optional package imports.

Example

Example of usage of the voice support, install the speaker package and run it. type !join in chat, it will join the vc, talk in the vc, you'll be able to here your self

import { Bot, BotEvent } from "@node-discord/core"
import Speaker from 'speaker'

const client = new Bot("token");

client.events.on(BotEvent.Ready, () => {
     console.log(`${client.user.fullName} is ready to test Day's lib`)
})

client.events.on(BotEvent.VoiceServerUpdate, console.log)

const speaker = new Speaker({ channels: 2, sampleRate: 48000 })

client.events.on(BotEvent.MessageCreate, async message => {

    if (message.content !== "!join") return

    const connection = await message.member.voice.currentChannel.join()

    console.log(connection)

    connection.sockets.udp.PCMOut.pipe(speaker)
})

client.connection.connect()

Can Bora Ciner and others added 30 commits August 31, 2020 14:26
To strict eslint rules, I've added vscode rules too
Client can only receive sounds but not send right now
I just realised .idea is ignored by .gitignore, if its ignored this should be too
Otherwise it caused errors
since its already compiled it wont need to be recompiled there.
The installing duration decreases significantly.
Can Bora Ciner and others added 23 commits September 1, 2020 12:21
async/await isnt supported below and in the compiled files there are many useless functions
The reason behind this is local testing.
When you try to run npm build, it will give you a dist folder,
but if you run ci:build it will give you a lib folder
@cborac cborac closed this Sep 2, 2020
@cborac cborac reopened this Sep 2, 2020
@cborac
Copy link
Contributor Author

cborac commented Sep 2, 2020

Dont ask why did I closed and reopened this, it was an accident

@cborac
Copy link
Contributor Author

cborac commented Dec 1, 2020

Ok adding the dist folder in source code isnt a great idea

@cborac
Copy link
Contributor Author

cborac commented Jun 28, 2022

Please accept this 😭

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

Successfully merging this pull request may close these issues.

1 participant