Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.
/ granitepy Public archive

A library for the lavalink like audio provider called andesite NOTE: This project will no longer be updated.

License

Notifications You must be signed in to change notification settings

twitch0001/granitepy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

granitepy

A library for the Lavalink like audio provider called Andesite for use with discord.py

For support join here and click here for the Official Documentation

Installing

The library is on Pypi and is installed with pip install granitepy however 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:https://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 of 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 library 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.

About

A library for the lavalink like audio provider called andesite NOTE: This project will no longer be updated.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published