testvoltricx 1.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- testvoltricx-1.0.5/LICENSE +21 -0
- testvoltricx-1.0.5/PKG-INFO +206 -0
- testvoltricx-1.0.5/README.md +183 -0
- testvoltricx-1.0.5/pyproject.toml +55 -0
- testvoltricx-1.0.5/setup.cfg +4 -0
- testvoltricx-1.0.5/tests/test_backoff.py +81 -0
- testvoltricx-1.0.5/tests/test_coverage_final.py +432 -0
- testvoltricx-1.0.5/tests/test_exceptions.py +133 -0
- testvoltricx-1.0.5/tests/test_filters.py +76 -0
- testvoltricx-1.0.5/tests/test_filters_extended.py +405 -0
- testvoltricx-1.0.5/tests/test_hypercache.py +201 -0
- testvoltricx-1.0.5/tests/test_logger.py +174 -0
- testvoltricx-1.0.5/tests/test_node.py +519 -0
- testvoltricx-1.0.5/tests/test_player.py +87 -0
- testvoltricx-1.0.5/tests/test_player_edge.py +525 -0
- testvoltricx-1.0.5/tests/test_player_extended.py +598 -0
- testvoltricx-1.0.5/tests/test_pool.py +64 -0
- testvoltricx-1.0.5/tests/test_pool_edge.py +374 -0
- testvoltricx-1.0.5/tests/test_pool_extended.py +245 -0
- testvoltricx-1.0.5/tests/test_queue.py +117 -0
- testvoltricx-1.0.5/tests/test_queue_extended.py +381 -0
- testvoltricx-1.0.5/tests/test_track.py +207 -0
- testvoltricx-1.0.5/tests/test_utils.py +51 -0
- testvoltricx-1.0.5/tests/test_websocket.py +445 -0
- testvoltricx-1.0.5/testvoltricx.egg-info/PKG-INFO +206 -0
- testvoltricx-1.0.5/testvoltricx.egg-info/SOURCES.txt +52 -0
- testvoltricx-1.0.5/testvoltricx.egg-info/dependency_links.txt +1 -0
- testvoltricx-1.0.5/testvoltricx.egg-info/requires.txt +12 -0
- testvoltricx-1.0.5/testvoltricx.egg-info/top_level.txt +1 -0
- testvoltricx-1.0.5/voltricx/__init__.py +94 -0
- testvoltricx-1.0.5/voltricx/__main__.py +68 -0
- testvoltricx-1.0.5/voltricx/backoff.py +73 -0
- testvoltricx-1.0.5/voltricx/exceptions.py +101 -0
- testvoltricx-1.0.5/voltricx/filters.py +553 -0
- testvoltricx-1.0.5/voltricx/hypercache.py +251 -0
- testvoltricx-1.0.5/voltricx/logger.py +205 -0
- testvoltricx-1.0.5/voltricx/node.py +344 -0
- testvoltricx-1.0.5/voltricx/player.py +841 -0
- testvoltricx-1.0.5/voltricx/pool.py +484 -0
- testvoltricx-1.0.5/voltricx/queue.py +294 -0
- testvoltricx-1.0.5/voltricx/typings/__init__.py +37 -0
- testvoltricx-1.0.5/voltricx/typings/base.py +27 -0
- testvoltricx-1.0.5/voltricx/typings/common.py +59 -0
- testvoltricx-1.0.5/voltricx/typings/enums.py +91 -0
- testvoltricx-1.0.5/voltricx/typings/events.py +84 -0
- testvoltricx-1.0.5/voltricx/typings/filters.py +98 -0
- testvoltricx-1.0.5/voltricx/typings/node.py +104 -0
- testvoltricx-1.0.5/voltricx/typings/player.py +70 -0
- testvoltricx-1.0.5/voltricx/typings/routeplanner.py +57 -0
- testvoltricx-1.0.5/voltricx/typings/session.py +37 -0
- testvoltricx-1.0.5/voltricx/typings/track.py +226 -0
- testvoltricx-1.0.5/voltricx/typings/websocket.py +84 -0
- testvoltricx-1.0.5/voltricx/utils.py +99 -0
- testvoltricx-1.0.5/voltricx/websocket.py +240 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-Present @JustNixx, @Dipendra-creator and RevvLabs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: testvoltricx
|
|
3
|
+
Version: 1.0.5
|
|
4
|
+
Summary: A modern, simple, and powerful Lavalink wrapper for discord.py.
|
|
5
|
+
Author: @JustNixx, @Dipendra-creator
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ded-lmfao/voltricx
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: discord.py>=2.0.0
|
|
12
|
+
Requires-Dist: pydantic>=2.0.0
|
|
13
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
14
|
+
Requires-Dist: yarl>=1.9.0
|
|
15
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: ruff>=0.3.0; extra == "dev"
|
|
18
|
+
Requires-Dist: pyright>=1.1.300; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
<div align="center">
|
|
25
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/banner.svg" width="100%" alt="Voltricx Banner">
|
|
26
|
+
|
|
27
|
+
<h3>The Next-Generation Lavalink Wrapper for Python</h3>
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
<a href="https://pypi.org/project/voltricx/" style="text-decoration:none;"><img src="https://img.shields.io/badge/PyPI-v1.0.5-blue?style=for-the-badge&logo=pypi" alt="PyPI version"></a>
|
|
31
|
+
<a href="https://pypi.org/project/voltricx/" style="text-decoration:none;"><img src="https://img.shields.io/badge/python-3.12%2B-3776AB?style=for-the-badge&logo=python" alt="Python versions"></a>
|
|
32
|
+
<a href="LICENSE" style="text-decoration:none;"><img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge" alt="License"></a>
|
|
33
|
+
<img src="https://img.shields.io/badge/Status-Stable-brightgreen?style=for-the-badge" alt="Status">
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<a href="https://lavalink.dev"><img src="https://img.shields.io/badge/Lavalink-v4.0%2B-FB7713?style=flat-square&logo=lavalink" alt="Lavalink version"></a>
|
|
38
|
+
<img src="https://img.shields.io/badge/Plugins-Native_Support-FB7713?style=flat-square" alt="Plugins Support">
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://ded-lmfao.github.io/revvcore/"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/deploy-docs.yml?branch=main&label=Docs&logo=readthedocs&style=flat-square" alt="Docs"></a>
|
|
43
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/version_checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/version_checks.yml?branch=main&label=Version%20Checks&logo=githubactions&style=flat-square" alt="Version Checks"></a>
|
|
44
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/version_checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/version_checks.yml?branch=main&label=Ruff&logo=ruff&style=flat-square" alt="Ruff Checks"></a>
|
|
45
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/version_checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/version_checks.yml?branch=main&label=Pyright&logo=python&style=flat-square" alt="Pyright"></a>
|
|
46
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/version_checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/version_checks.yml?branch=main&label=Pytest&logo=pytest&style=flat-square" alt="Pytest"></a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<p align="center">
|
|
51
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/build_and_publish.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/build_and_publish.yml?label=Publish%20to%20PyPI&style=flat-square" alt="Publish to PyPI"></a>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
<p align="center">
|
|
56
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/quality_gate.svg" alt="Quality Gate">
|
|
57
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/coverage.svg" alt="Coverage">
|
|
58
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/bugs.svg" alt="Bugs">
|
|
59
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/vulnerabilities.svg" alt="Vulnerabilities">
|
|
60
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/code_smells.svg" alt="Code Smells">
|
|
61
|
+
</p>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
**Voltricx** is a high-performance, feature-rich Lavalink wrapper built for modern Discord bot development in Python. Engineered for speed, reliability, and ease of use, Voltricx offers a professional-grade API that makes audio integration seamless and powerful.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Table of Contents
|
|
71
|
+
- [Why Voltricx?](#why-voltricx)
|
|
72
|
+
- [Features](#features)
|
|
73
|
+
- [Installation](#installation)
|
|
74
|
+
- [Quickstart](#quickstart)
|
|
75
|
+
- [Examples](#examples)
|
|
76
|
+
- [Contributing](#contributing)
|
|
77
|
+
- [License](#license)
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Why Voltricx?
|
|
82
|
+
|
|
83
|
+
<table border="0">
|
|
84
|
+
<tr>
|
|
85
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
86
|
+
<td valign="middle"><strong>Next-Gen Performance</strong>: Dual-tier caching (LRU/LFU) powered by <code>HyperCache</code> for lightning-fast data retrieval.</td>
|
|
87
|
+
</tr>
|
|
88
|
+
<tr>
|
|
89
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
90
|
+
<td valign="middle"><strong>Strictly Typed</strong>: Comprehensive type hinting and Pydantic v2 validation ensure your code is robust and maintainable.</td>
|
|
91
|
+
</tr>
|
|
92
|
+
<tr>
|
|
93
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
94
|
+
<td valign="middle"><strong>High-Fidelity Failover</strong>: Automated node shifting and silent reconnects ensure a seamless listening experience.</td>
|
|
95
|
+
</tr>
|
|
96
|
+
<tr>
|
|
97
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
98
|
+
<td valign="middle"><strong>Modern Standards</strong>: Fully compatible with Lavalink v4.0+, including native support for the DAVE E2EE protocol and filters.</td>
|
|
99
|
+
</tr>
|
|
100
|
+
<tr>
|
|
101
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
102
|
+
<td valign="middle"><strong>Smart Load Balancing</strong>: Advanced penalty-based node selection for optimal performance across multiple Lavalink nodes.</td>
|
|
103
|
+
</tr>
|
|
104
|
+
</table>
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Features
|
|
109
|
+
|
|
110
|
+
- 🚀 **Asynchronous Architecture**: Built from the ground up to be fully async and non-blocking.
|
|
111
|
+
- 📡 **Websocket Management**: Efficient handling of Lavalink websocket connections with automatic retries.
|
|
112
|
+
- 🎹 **Rich Audio Control**: Full support for filters including Equalizer, Timescale, Vibrato, and more.
|
|
113
|
+
- 🌐 **DAVE Protocol**: Support for the latest Discord Audio Video Encryption standards.
|
|
114
|
+
- ⚖️ **Regional Selection**: Intelligent node selection based on guild region and node latency.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Installation
|
|
119
|
+
|
|
120
|
+
Voltricx requires **Python 3.12+**.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Stable version from PyPI
|
|
124
|
+
pip install voltricx
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
For the latest development version:
|
|
128
|
+
```bash
|
|
129
|
+
pip install git+https://github.com/ded-lmfao/voltricx.git
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Quickstart
|
|
135
|
+
|
|
136
|
+
Here is a minimal example of how to get up and running with Voltricx.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
import discord
|
|
140
|
+
from discord.ext import commands
|
|
141
|
+
import voltricx
|
|
142
|
+
|
|
143
|
+
class MyBot(commands.Bot):
|
|
144
|
+
def __init__(self):
|
|
145
|
+
super().__init__(command_prefix="!", intents=discord.Intents.all())
|
|
146
|
+
|
|
147
|
+
async def setup_hook(self):
|
|
148
|
+
# Configuration for your Lavalink Node
|
|
149
|
+
config = voltricx.NodeConfig(
|
|
150
|
+
uri="http://localhost:2333",
|
|
151
|
+
password="youshallnotpass",
|
|
152
|
+
identifier="MAIN-NODE"
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
# Initialize the Pool and add the node
|
|
156
|
+
node = voltricx.Node(config=config)
|
|
157
|
+
await voltricx.Pool.add_node(node)
|
|
158
|
+
|
|
159
|
+
bot = MyBot()
|
|
160
|
+
|
|
161
|
+
@bot.event
|
|
162
|
+
async def on_voltricx_node_ready(node: voltricx.Node):
|
|
163
|
+
print(f"✅ Lavalink Node {node.identifier} is ready and connected!")
|
|
164
|
+
|
|
165
|
+
@bot.command()
|
|
166
|
+
async def play(ctx, *, query: str):
|
|
167
|
+
# Retrieve or create a player for the guild
|
|
168
|
+
player: voltricx.Player = ctx.voice_client or await ctx.author.voice.channel.connect(cls=voltricx.Player)
|
|
169
|
+
|
|
170
|
+
# Search for tracks
|
|
171
|
+
tracks = await voltricx.Pool.get_tracks(query)
|
|
172
|
+
if not tracks:
|
|
173
|
+
return await ctx.send("❌ No tracks found.")
|
|
174
|
+
|
|
175
|
+
track = tracks[0]
|
|
176
|
+
await player.play(track)
|
|
177
|
+
await ctx.send(f"🎶 **Now playing**: {track.title}")
|
|
178
|
+
|
|
179
|
+
bot.run("YOUR_BOT_TOKEN")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Examples
|
|
185
|
+
|
|
186
|
+
Check the [example](example/) directory for advanced usage, including:
|
|
187
|
+
- [Basic Bot Implementation](example/main.py)
|
|
188
|
+
- Custom Queue Handlers
|
|
189
|
+
- Advanced Filters (Nightcore, etc.)
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Contributing
|
|
194
|
+
|
|
195
|
+
We welcome contributions! If you'd like to help improve Voltricx:
|
|
196
|
+
1. **Fork** the repository.
|
|
197
|
+
2. **Clone** your fork and create a new feature branch (`git checkout -b feature/amazing-feature`).
|
|
198
|
+
3. **Commit** your improvements (`git commit -m 'feat: add some amazing feature'`).
|
|
199
|
+
4. **Push** the changes to your fork (`git push origin feature/amazing-feature`).
|
|
200
|
+
5. **Open a Pull Request**.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> License
|
|
205
|
+
|
|
206
|
+
Voltricx is released under the MIT License. See [LICENSE](LICENSE) for more information.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/banner.svg" width="100%" alt="Voltricx Banner">
|
|
3
|
+
|
|
4
|
+
<h3>The Next-Generation Lavalink Wrapper for Python</h3>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://pypi.org/project/voltricx/" style="text-decoration:none;"><img src="https://img.shields.io/badge/PyPI-v1.0.5-blue?style=for-the-badge&logo=pypi" alt="PyPI version"></a>
|
|
8
|
+
<a href="https://pypi.org/project/voltricx/" style="text-decoration:none;"><img src="https://img.shields.io/badge/python-3.12%2B-3776AB?style=for-the-badge&logo=python" alt="Python versions"></a>
|
|
9
|
+
<a href="LICENSE" style="text-decoration:none;"><img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge" alt="License"></a>
|
|
10
|
+
<img src="https://img.shields.io/badge/Status-Stable-brightgreen?style=for-the-badge" alt="Status">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://lavalink.dev"><img src="https://img.shields.io/badge/Lavalink-v4.0%2B-FB7713?style=flat-square&logo=lavalink" alt="Lavalink version"></a>
|
|
15
|
+
<img src="https://img.shields.io/badge/Plugins-Native_Support-FB7713?style=flat-square" alt="Plugins Support">
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://ded-lmfao.github.io/revvcore/"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/deploy-docs.yml?branch=main&label=Docs&logo=readthedocs&style=flat-square" alt="Docs"></a>
|
|
20
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/version_checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/version_checks.yml?branch=main&label=Version%20Checks&logo=githubactions&style=flat-square" alt="Version Checks"></a>
|
|
21
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/version_checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/version_checks.yml?branch=main&label=Ruff&logo=ruff&style=flat-square" alt="Ruff Checks"></a>
|
|
22
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/version_checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/version_checks.yml?branch=main&label=Pyright&logo=python&style=flat-square" alt="Pyright"></a>
|
|
23
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/version_checks.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/version_checks.yml?branch=main&label=Pytest&logo=pytest&style=flat-square" alt="Pytest"></a>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<p align="center">
|
|
28
|
+
<a href="https://github.com/ded-lmfao/revvcore/actions/workflows/build_and_publish.yml"><img src="https://img.shields.io/github/actions/workflow/status/ded-lmfao/revvcore/build_and_publish.yml?label=Publish%20to%20PyPI&style=flat-square" alt="Publish to PyPI"></a>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/quality_gate.svg" alt="Quality Gate">
|
|
34
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/coverage.svg" alt="Coverage">
|
|
35
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/bugs.svg" alt="Bugs">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/vulnerabilities.svg" alt="Vulnerabilities">
|
|
37
|
+
<img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/shield-stats/assets/code_smells.svg" alt="Code Smells">
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
**Voltricx** is a high-performance, feature-rich Lavalink wrapper built for modern Discord bot development in Python. Engineered for speed, reliability, and ease of use, Voltricx offers a professional-grade API that makes audio integration seamless and powerful.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Table of Contents
|
|
48
|
+
- [Why Voltricx?](#why-voltricx)
|
|
49
|
+
- [Features](#features)
|
|
50
|
+
- [Installation](#installation)
|
|
51
|
+
- [Quickstart](#quickstart)
|
|
52
|
+
- [Examples](#examples)
|
|
53
|
+
- [Contributing](#contributing)
|
|
54
|
+
- [License](#license)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Why Voltricx?
|
|
59
|
+
|
|
60
|
+
<table border="0">
|
|
61
|
+
<tr>
|
|
62
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
63
|
+
<td valign="middle"><strong>Next-Gen Performance</strong>: Dual-tier caching (LRU/LFU) powered by <code>HyperCache</code> for lightning-fast data retrieval.</td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr>
|
|
66
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
67
|
+
<td valign="middle"><strong>Strictly Typed</strong>: Comprehensive type hinting and Pydantic v2 validation ensure your code is robust and maintainable.</td>
|
|
68
|
+
</tr>
|
|
69
|
+
<tr>
|
|
70
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
71
|
+
<td valign="middle"><strong>High-Fidelity Failover</strong>: Automated node shifting and silent reconnects ensure a seamless listening experience.</td>
|
|
72
|
+
</tr>
|
|
73
|
+
<tr>
|
|
74
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
75
|
+
<td valign="middle"><strong>Modern Standards</strong>: Fully compatible with Lavalink v4.0+, including native support for the DAVE E2EE protocol and filters.</td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr>
|
|
78
|
+
<td width="52" valign="middle"><img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="44" alt="Icon"></td>
|
|
79
|
+
<td valign="middle"><strong>Smart Load Balancing</strong>: Advanced penalty-based node selection for optimal performance across multiple Lavalink nodes.</td>
|
|
80
|
+
</tr>
|
|
81
|
+
</table>
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Features
|
|
86
|
+
|
|
87
|
+
- 🚀 **Asynchronous Architecture**: Built from the ground up to be fully async and non-blocking.
|
|
88
|
+
- 📡 **Websocket Management**: Efficient handling of Lavalink websocket connections with automatic retries.
|
|
89
|
+
- 🎹 **Rich Audio Control**: Full support for filters including Equalizer, Timescale, Vibrato, and more.
|
|
90
|
+
- 🌐 **DAVE Protocol**: Support for the latest Discord Audio Video Encryption standards.
|
|
91
|
+
- ⚖️ **Regional Selection**: Intelligent node selection based on guild region and node latency.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Installation
|
|
96
|
+
|
|
97
|
+
Voltricx requires **Python 3.12+**.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Stable version from PyPI
|
|
101
|
+
pip install voltricx
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
For the latest development version:
|
|
105
|
+
```bash
|
|
106
|
+
pip install git+https://github.com/ded-lmfao/voltricx.git
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Quickstart
|
|
112
|
+
|
|
113
|
+
Here is a minimal example of how to get up and running with Voltricx.
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
import discord
|
|
117
|
+
from discord.ext import commands
|
|
118
|
+
import voltricx
|
|
119
|
+
|
|
120
|
+
class MyBot(commands.Bot):
|
|
121
|
+
def __init__(self):
|
|
122
|
+
super().__init__(command_prefix="!", intents=discord.Intents.all())
|
|
123
|
+
|
|
124
|
+
async def setup_hook(self):
|
|
125
|
+
# Configuration for your Lavalink Node
|
|
126
|
+
config = voltricx.NodeConfig(
|
|
127
|
+
uri="http://localhost:2333",
|
|
128
|
+
password="youshallnotpass",
|
|
129
|
+
identifier="MAIN-NODE"
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
# Initialize the Pool and add the node
|
|
133
|
+
node = voltricx.Node(config=config)
|
|
134
|
+
await voltricx.Pool.add_node(node)
|
|
135
|
+
|
|
136
|
+
bot = MyBot()
|
|
137
|
+
|
|
138
|
+
@bot.event
|
|
139
|
+
async def on_voltricx_node_ready(node: voltricx.Node):
|
|
140
|
+
print(f"✅ Lavalink Node {node.identifier} is ready and connected!")
|
|
141
|
+
|
|
142
|
+
@bot.command()
|
|
143
|
+
async def play(ctx, *, query: str):
|
|
144
|
+
# Retrieve or create a player for the guild
|
|
145
|
+
player: voltricx.Player = ctx.voice_client or await ctx.author.voice.channel.connect(cls=voltricx.Player)
|
|
146
|
+
|
|
147
|
+
# Search for tracks
|
|
148
|
+
tracks = await voltricx.Pool.get_tracks(query)
|
|
149
|
+
if not tracks:
|
|
150
|
+
return await ctx.send("❌ No tracks found.")
|
|
151
|
+
|
|
152
|
+
track = tracks[0]
|
|
153
|
+
await player.play(track)
|
|
154
|
+
await ctx.send(f"🎶 **Now playing**: {track.title}")
|
|
155
|
+
|
|
156
|
+
bot.run("YOUR_BOT_TOKEN")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Examples
|
|
162
|
+
|
|
163
|
+
Check the [example](example/) directory for advanced usage, including:
|
|
164
|
+
- [Basic Bot Implementation](example/main.py)
|
|
165
|
+
- Custom Queue Handlers
|
|
166
|
+
- Advanced Filters (Nightcore, etc.)
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> Contributing
|
|
171
|
+
|
|
172
|
+
We welcome contributions! If you'd like to help improve Voltricx:
|
|
173
|
+
1. **Fork** the repository.
|
|
174
|
+
2. **Clone** your fork and create a new feature branch (`git checkout -b feature/amazing-feature`).
|
|
175
|
+
3. **Commit** your improvements (`git commit -m 'feat: add some amazing feature'`).
|
|
176
|
+
4. **Push** the changes to your fork (`git push origin feature/amazing-feature`).
|
|
177
|
+
5. **Open a Pull Request**.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### <img src="https://raw.githubusercontent.com/ded-lmfao/revvcore/refs/heads/main/assets/logo.svg" width="32" align="center" alt="Icon"> License
|
|
182
|
+
|
|
183
|
+
Voltricx is released under the MIT License. See [LICENSE](LICENSE) for more information.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "testvoltricx"
|
|
7
|
+
version = "1.0.5"
|
|
8
|
+
description = "A modern, simple, and powerful Lavalink wrapper for discord.py."
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "@JustNixx" },
|
|
11
|
+
{ name = "@Dipendra-creator" }
|
|
12
|
+
]
|
|
13
|
+
license = { text = "MIT" }
|
|
14
|
+
readme = "README.md"
|
|
15
|
+
requires-python = ">=3.12"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"discord.py>=2.0.0",
|
|
18
|
+
"pydantic>=2.0.0",
|
|
19
|
+
"aiohttp>=3.8.0",
|
|
20
|
+
"yarl>=1.9.0",
|
|
21
|
+
"python-dotenv>=1.0.0"
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
dev = [
|
|
26
|
+
"ruff>=0.3.0",
|
|
27
|
+
"pyright>=1.1.300",
|
|
28
|
+
"pytest>=8.0.0",
|
|
29
|
+
"pytest-asyncio>=0.23.0",
|
|
30
|
+
"pytest-cov>=4.1.0"
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/ded-lmfao/voltricx"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["."]
|
|
38
|
+
include = ["voltricx*"]
|
|
39
|
+
|
|
40
|
+
[tool.ruff]
|
|
41
|
+
target-version = "py312"
|
|
42
|
+
line-length = 100
|
|
43
|
+
|
|
44
|
+
[tool.ruff.lint]
|
|
45
|
+
select = ["E", "F", "W", "I", "UP"]
|
|
46
|
+
ignore = [
|
|
47
|
+
"E501", # line too long — handled by formatter
|
|
48
|
+
"UP007", # use X | Y for Union — already done; suppress for Annotated[] edge cases
|
|
49
|
+
]
|
|
50
|
+
# Allow F401 on re-export modules (__init__.py, typings/__init__.py)
|
|
51
|
+
per-file-ignores = { "voltricx/__init__.py" = ["F401"], "voltricx/typings/__init__.py" = ["F401", "F403"] }
|
|
52
|
+
|
|
53
|
+
[tool.ruff.format]
|
|
54
|
+
quote-style = "double"
|
|
55
|
+
indent-style = "space"
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""Tests for voltricx.backoff — targeting 100% branch coverage."""
|
|
2
|
+
|
|
3
|
+
from voltricx.backoff import Backoff
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_backoff_initial_state():
|
|
7
|
+
b = Backoff()
|
|
8
|
+
assert b.base == 1
|
|
9
|
+
assert b.maximum == 30.0
|
|
10
|
+
assert b.max_tries == 5
|
|
11
|
+
assert b.retries == 1
|
|
12
|
+
assert b._last_wait == 0
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def test_backoff_custom_params():
|
|
16
|
+
b = Backoff(base=2, maximum=60.0, max_tries=10)
|
|
17
|
+
assert b.base == 2
|
|
18
|
+
assert b.maximum == 60.0
|
|
19
|
+
assert b.max_tries == 10
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_backoff_calculate_returns_float():
|
|
23
|
+
b = Backoff()
|
|
24
|
+
wait = b.calculate()
|
|
25
|
+
assert isinstance(wait, float)
|
|
26
|
+
assert wait >= 0
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_backoff_calculate_does_not_exceed_maximum():
|
|
30
|
+
b = Backoff(base=1, maximum=5.0, max_tries=None)
|
|
31
|
+
for _ in range(20):
|
|
32
|
+
wait = b.calculate()
|
|
33
|
+
assert wait <= 5.0
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_backoff_reset():
|
|
37
|
+
b = Backoff()
|
|
38
|
+
b.calculate()
|
|
39
|
+
b.calculate()
|
|
40
|
+
b.reset()
|
|
41
|
+
assert b.retries == 1
|
|
42
|
+
assert b._last_wait == 0
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_backoff_resets_after_max_tries():
|
|
46
|
+
b = Backoff(base=1, maximum=100.0, max_tries=3)
|
|
47
|
+
for _ in range(3):
|
|
48
|
+
b.calculate()
|
|
49
|
+
# After max_tries exhausted, retries resets
|
|
50
|
+
assert b.retries == 1
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_backoff_indefinite_run():
|
|
54
|
+
"""max_tries=None should never reset due to retries."""
|
|
55
|
+
b = Backoff(base=1, maximum=30.0, max_tries=None)
|
|
56
|
+
# Run many times — should not crash or exceed maximum
|
|
57
|
+
for _ in range(50):
|
|
58
|
+
wait = b.calculate()
|
|
59
|
+
assert wait <= 30.0
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_backoff_wait_doubles_when_below_last():
|
|
63
|
+
"""Forces the wait < _last_wait branch."""
|
|
64
|
+
b = Backoff(base=1, maximum=1000.0, max_tries=None)
|
|
65
|
+
# Manually set a very high last_wait so random wait will be < last_wait
|
|
66
|
+
b._last_wait = 999.0
|
|
67
|
+
b.retries = 1
|
|
68
|
+
wait = b.calculate()
|
|
69
|
+
# Should double the last_wait (999.0 * 2 = 1998.0) but capped at maximum
|
|
70
|
+
assert wait <= 1000.0
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_backoff_resets_on_exceeding_maximum():
|
|
74
|
+
"""When wait > maximum, retries and _last_wait reset."""
|
|
75
|
+
b = Backoff(base=1, maximum=0.001, max_tries=None)
|
|
76
|
+
b._last_wait = 999.0 # force doubling path
|
|
77
|
+
b.retries = 1
|
|
78
|
+
b.calculate()
|
|
79
|
+
# After exceeding maximum, state should reset
|
|
80
|
+
assert b._last_wait == 0
|
|
81
|
+
assert b.retries == 1
|