A python client for the audio provider Andesite for use with discord.py.
Project description
granitepy
granitepy is a library for the Lavalink like audio provider called Andesite for use with discord.py.
Links
- Discord supprt server
- Documentation (Coming soon)
Installation
From Pypi
pip install -U granitepy
From Github
pip install -U git+https://github.com/iDivision/granitepy
Example
from discord.ext import commands
import granitepy
bot = commands.Bot(command_prefix = "!")
bot.andesite = granitepy.Client(bot)
@bot.event
async def on_ready():
await bot.andesite.create_node(
host="node-ip",
port=12345,
password="node-password",
identifier="node-name",
)
@bot.command()
async def connect(ctx):
player = bot.andesite.get_player(ctx.guild.id) # Creates or fetches a player
if not ctx.author.voice:
return await ctx.send("Must be connected to a voice channel")
await player.connect(ctx.author.voice.channel.id) # Connects to the channel the command invoker is in.
await ctx.send(f"Connected to {ctx.author.voice.channel.name}!")
@bot.command()
async def play(ctx, *, search):
player = bot.andesite.get_player(ctx.guild.id)
tracks = await player.node.get_tracks(f"ytsearch: {search}") # Returns a list of andesite.Track objects
if not tracks: # Andesite returned no tracks.
return await ctx.send("No tracks were found.")
await player.play(tracks[0]) # Plays the first track from the list.
bot.run("token")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
granitepy-0.2.2a0.tar.gz
(7.7 kB
view hashes)
Built Distribution
Close
Hashes for granitepy-0.2.2a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b5400605ba9589c744e230e7b595ed016b1ed3494ba8ca694b1836d6d24f74b |
|
MD5 | 90643925b931eb04c2b3a88239c89ff6 |
|
BLAKE2b-256 | 4dc0a961c11ca85ff23de10013422af281df7dfd8debea4c25a12d00fa2debb7 |