A wrapper around Obsidian's REST and Websocket API.
Project description
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.
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
Built Distribution
File details
Details for the file obsidian.py-0.3.0.tar.gz
.
File metadata
- Download URL: obsidian.py-0.3.0.tar.gz
- Upload date:
- Size: 33.3 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc9177354772c496556ea4a841c5f5e00ccd14b1f7ceeb349b38616719dc57e4 |
|
MD5 | 06ff3901737375e1ea4ac905834280a2 |
|
BLAKE2b-256 | 3f829a892d18dd5a770036af83c4b3d1a52e4055de21a7772485fabdbadcd971 |
File details
Details for the file obsidian.py-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: obsidian.py-0.3.0-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2dfade92c8ea947844e89efc2a8f280a55a11a2f55fcb72f1f1138167fed512 |
|
MD5 | 4348559f40d3c40d8d9ed6d0aa5dcf03 |
|
BLAKE2b-256 | b97b770451ee0720c99a432d3e6224994ac88745bd6b83a9197cd2ed8d4daa23 |