Metadata-Version: 2.1
Name: interactions-lavalink
Version: 0.0.1
Summary: Lavalink and voice support for interactions.py
Home-page: https://github.com/Damego/interactions-lavalink
Author: Damego
Author-email: damego.dev@gmail.com
License: GPL-3.0 License
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: discord-py-interactions (>=4.3.0)
Requires-Dist: lavalink

# interactions-lavalink



## Installation



1. Download Java if you don't have it

2. Download lavalink from [this repo](https://github.com/freyacodes/Lavalink)

3. Configure `application.yml` file like [here](https://github.com/freyacodes/Lavalink/blob/master/LavalinkServer/application.yml.example)

4. Download ext via `pip install interactions-lavalink`



## Usage



Run lavalink via `java -jar Lavalink.jar` in same folder with `application.yml` file.  

Create bot like example and run it.



```python

import interactions

from interactions.ext.lavalink import VoiceState, VoiceClient



client = VoiceClient(...)



@client.event()

async def on_start():

    client.lavalink_client.add_node("127.0.0.1", 43421, "your_password", "eu")  # Copy host, port and password from `application.yml`



@client.event()

async def on_voice_state_update(before: VoiceState, after: VoiceState):

    ...



@client.command()

@interactions.option()

async def play(ctx: interactions.CommandContext, query: str):

    voice_state = client.get_user_voice_state(ctx.author.id)  # Can be `None` if not cached.

    player = await client.connect(ctx.guild_id, voice_state.channel_id)

    results = await player.node.get_tracks(f"ytsearch:{query}")

    player.add(requester=int(ctx.author.id), track=results["tracks"][0])

    await player.play()





client.start()

```



Example with using `Extension` [here](https://github.com/Damego/interactions-lavalink/tree/main/examples)



## Credits



Thanks EdVraz for `VoiceState` from [voice ext](https://github.com/interactions-py/voice)



