A library for the lavalink like audio provider called andesite
Project description
granitepy
A library for the Lavalink like audio provider called Andesite for use with discord.py
For support join here and here for the Official Documentation
Installing
The library is on Pypi and is installed with pip install granitepy
but a more updated version is on github and can be installed with git
pip install git+https://github.com/twitch0001/granitepy
Example
import discord
from discord.ext import commands
import andesite # import the lib
bot = commands.Bot(command_prefix = "!")
bot.andesite = andesite.Client(bot)
@bot.event
async def on_ready():
await bot.andesite.start_node(
"127.0.0.1",
5000,
rest_uri = "http://127.0.0.1:5000/",
password = None, # set as None if andesite password in application.conf is null :smh:
identifier = "hello-there", # identifier is only for internal use.
)
@bot.command()
async def connect(ctx):
player = bot.andesite.get_player(ctx.guild.id) # fetches the 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 andesite.Track objects
if not tracks: # andesite returned no tracks.
return await ctx.send("Nothing found.")
await player.play(tracks[0]) # plays the first track from the list.
bot.run("token")
This lib is heavily based on Wavelink made by EvieePy Huge thanks for making wavelink, would be stuck on a few connection things if it weren't for wavelink.
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.0.19a0.tar.gz
(9.3 kB
view hashes)
Built Distributions
granitepy-0.0.19a0-py3.7.egg
(24.3 kB
view hashes)
Close
Hashes for granitepy-0.0.19a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b6cee22276805cbeb8b3e80a3fe3d99bbcc8347ec82a37fbc1ca8bc1407efb4 |
|
MD5 | aaddb1b4344744210f0ff0281880886a |
|
BLAKE2b-256 | dc48c5518b8cb72435b9803ffa959da35588dc7b7d4a0cc05c02ee727136e237 |