obsidian.py
A wrapper around Obsidian's REST and Websocket API.
View on PyPI
or
Read the Docs
What is obsidian.py?
A fully object-oriented wrapper around Obsidian v2 designed for discord.py.
This wrapper is based off of Slate.
Requirements
Python (3.7+)
Obsidian (v2)
Features
- 100% coverage
- Fully asynchronous
- Object oriented
- Playlist support
- Advanced audio filter support
- Querying tracks from many sources
- Spotify support
- Preset classes
- Fully typed
Documentation
You can view documentation on the core library here.
Setting up Obsidian & obsidian.py
Downloading Obsidian
First, we must download Obsidian itself.
The JAR located in current Obsidian respoitory is outdated, however the working build can be downloaded here.
Creating obsidian.yml
You must have an obsidian.yml file before running Obsidian.
Create/download the file in the same directory as the JAR file (mentioned above).
Installing obsidian.py
Next, let's install obsidian.py.
You can download it directly from PyPI (Using pip):
$ pip install obsidian.py
Or, if you want early access to new additions for obsidian.py, clone directly from Github:
$ pip install git+https://github.com/jay3332/obsidian.py
Running Obsidian
Make sure you have Java 16 or higher downloaded.
To run Obsidian, cd to the directory the JAR file you downloaded above is located in:
$ cd /path/to/directory
Then, run it using Java's command line tool:
$ cd /path/to/directory
$ java -jar Obsidian.jar
(Replace Obsidian.jar to the name of the JAR file.)
If successful, you should see many things getting logged into console.
You're all set - now you just have to write code.
See below for examples, or take a look into the examples folder.
Examples
Basic
import discord
import obsidian
from discord.ext import commands
class Bot(commands.Bot):
def __init__(self, **options):
super().__init__(**options)
self.loop.create_task(self.start_obsidian)
async def start_obsidian(self):
self.obsidian = await obsidian.initiate_node(bot=self)
bot = Bot(command_prefix='$')
@bot.command()
async def connect(ctx):
channel = ctx.author.voice.channel
player = ctx.bot.obsidian.get_player(ctx.guild)
await player.connect(channel)
@bot.command()
async def play(ctx, *, song: str):
player = ctx.bot.obsidian.get_player(ctx.guild)
track = await ctx.bot.obsidian.search_track(song, source=obsidian.Source.YOUTUBE)
await player.play(track)
if __name__ == '__main__':
bot.run('TOKEN')
Credits
Changelog
The changelog has been moved to our documentation page.
Metadata
Release files for obsidian.py 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| obsidian.py-0.3.0.tar.gz | 33.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| obsidian.py-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 71.2 kB
Release files / obsidian.py-0.3.0.tar.gz
| Download URL | obsidian.py-0.3.0.tar.gz |
|---|---|
| Size | 33.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bc9177354772c496556ea4a841c5f5e00ccd14b1f7ceeb349b38616719dc57e4
|
|
BLAKE2b-256 checksum How to use checksums |
3f829a892d18dd5a770036af83c4b3d1a52e4055de21a7772485fabdbadcd971
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|
Release files / obsidian.py-0.3.0-py3-none-any.whl
| Download URL | obsidian.py-0.3.0-py3-none-any.whl |
|---|---|
| Size | 37.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2dfade92c8ea947844e89efc2a8f280a55a11a2f55fcb72f1f1138167fed512
|
|
BLAKE2b-256 checksum How to use checksums |
b97b770451ee0720c99a432d3e6224994ac88745bd6b83a9197cd2ed8d4daa23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
|