granitepy
granitepy is a python wrapper for the Lavalink like audio provider called Andesite for use with discord.py.
Links
Installation
From Pypi
pip install -U granitepy
From Github
pip install -U git+https://github.com/iDevision/granitepy
Example
from discord.ext import commands
import granitepy
bot = commands.Bot(command_prefix = "!")
bot.granitepy = granitepy.Client(bot)
@bot.event
async def on_ready():
await bot.granitepy.create_node(
host="node-ip",
port=12345,
password="node-password",
identifier="node-name"
)
@bot.command()
async def connect(ctx):
# Create or fetch a player.
player = bot.granitepy.get_player(guild=ctx.guild)
# Check is the author is in a voice channel.
if not ctx.author.voice:
return await ctx.send("You must be connected to a voice channel")
# Connect to the authors voice channel.
await player.connect(ctx.author.voice.channel)
return await ctx.send(f"Connected to {ctx.author.voice.channel.name}!")
@bot.command()
async def play(ctx, *, search):
player = bot.granitepy.get_player(guild=ctx.guild)
# Search for whatever the user has inputted.
result = await player.get_tracks(search)
# The users search returned nothing.
if not result:
return await ctx.send("No tracks were found.")
# Check if the result is a playlist.
if isinstance(result, granitepy.Playlist):
# Play the first track in the playlist.
return await player.play(result.tracks[0])
else:
# Play the first track in the list of results.
return await player.play(result[0])
bot.run("token")
Metadata
Release files for granitepy 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| granitepy-0.4.2.tar.gz | 11.4 kB | Without provenance | Details for granitepy-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| granitepy-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for granitepy-0.4.2-py3-none-any.whl |
Total release size: 35.9 kB
Release files / granitepy-0.4.2.tar.gz
| Download URL | granitepy-0.4.2.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27758c990a5f82d4dd4d25169799510001401794d28ad4f0fc511470428aa05c
|
|
BLAKE2b-256 checksum How to use checksums |
af5aaa6fde9fd531a220169e32bf3e260b6caa03ff18cbcbbd889790b65fb273
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Release files / granitepy-0.4.2-py3-none-any.whl
| Download URL | granitepy-0.4.2-py3-none-any.whl |
|---|---|
| Size | 24.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
84a6133d6d8a14cf813dc3bc9752ad306986db1fd2897d8861947af1db5a78b2
|
|
BLAKE2b-256 checksum How to use checksums |
64332c77081dccca2645c74894d90ca753c236d69cc1e81bd02b21acef126f99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Security for granitepy 0.4.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.