Added yarn, bun and pnpm config; Added eslint and prettier; Refactored Type import; Updated Version;

This commit is contained in:
Lechner Julian - FrauJulian
2025-10-10 17:52:56 +02:00
parent af7a7e266f
commit 7412182b02
19 changed files with 15801 additions and 807 deletions
+26 -20
View File
@@ -15,19 +15,23 @@ Please create an [issue](https://github.com/FrauJulian/DiscordAudioStreamNPM/iss
## 📝 Usage
### Install package
### Install
```bash
npm install discord-audio-stream
yarn add discord-audio-stream
pnpm add discord-audio-stream
bun add discord-audio-stream
```
> #### NPM, yarn, pnpm and bun are supported.
>
> ```bash
> npm install discord-audio-stream @snazzah/davey @discordjs/opus
> yarn add discord-audio-stream @snazzah/davey @discordjs/opus
> pnpm add discord-audio-stream @snazzah/davey @discordjs/opus
> bun add discord-audio-stream @snazzah/davey @discordjs/opus
> ```
You need `@snazzah/davey` and one of the encryption libraries to run this package!
**Encryption Libraries (npm install):**
> You only need to install one of these libraries if your system does not support `aes-256-gcm` (verify by running
`require('node:crypto').getCiphers().includes('aes-256-gcm')`).
> `require('node:crypto').getCiphers().includes('aes-256-gcm')`).
- `sodium-native`
- `sodium`
@@ -54,15 +58,17 @@ let audioManager = new AudioManager();
or (with parameters)
```js
let audioManager = new AudioManager({
VoiceChannelId: 0, //voice channel id where to play music
GuildId: 0, //guild id
VoiceAdapter: 0 //guild VoiceAdapter
},
{
ResourceType: "", //resource type like link or file
Resource: "" //auto play link or file name
});
let audioManager = new AudioManager(
{
VoiceChannelId: 0, //voice channel id where to play music
GuildId: 0, //guild id
VoiceAdapter: 0, //guild VoiceAdapter
},
{
ResourceType: '', //resource type like link or file
Resource: '', //auto play link or file name
},
);
```
### Properties of the AudioManager
@@ -70,7 +76,7 @@ let audioManager = new AudioManager({
#### Properties
| Callable with | Type | Description |
|-------------------|------------------------------|-------------------------------------------------|
| ----------------- | ---------------------------- | ----------------------------------------------- |
| `VoiceConnection` | **VoiceConnection** | VoiceConnection instance from discord.js/voice. |
| `AudioPlayer` | **AudioPlayer** | AudioPlayer instance from discord.js/voice. |
| `AudioResource` | **AudioResource** | AudioResource instance from discord.js/voice. |
@@ -80,7 +86,7 @@ let audioManager = new AudioManager({
#### Methods
| Callable with | Parameters | Return type | Description |
|--------------------------------|---------------------------------------------------------|-------------|---------------------------------------------------------------|
| ------------------------------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------------- | -------------------------------------- |
| `OverrideVoiceConnectionData` | `connectionData` (type of **VoiceConnectionDataModel**) | void | Method to override global connectionData variable. |
| `OverrideVoiceAudioDataModel` | `audioData` (type of **VoiceAudioDataModel**) | void | Method to override global audioData variable. |
| `OverrideRenewInMs` | `renewInMs` (type of int, default value is 5400000) | void | Method to override global renewInMs variable. |
@@ -92,7 +98,7 @@ let audioManager = new AudioManager({
| `CreateConnectionAndPlayAudio` | | void | Method to join the voice connection and play audio. |
| `DestroyConnection` | | void | Method to destroy the voice connection. |
| `Dispose` | | void | Dispose all data in object. |
| `SetVolume` | `volume` (type of number, 0 - 100 percent) | void | Method to set the audio volume. | Method to set the volume of the audio. |
| `SetVolume` | `volume` (type of number, 0 - 100 percent) | void | Method to set the audio volume. | Method to set the volume of the audio. |
| `SetMaxListeners` | `maxListeners` (type of number) | void | Method to set the max listeners of the audio stream. |
##### Types History