A wrapper around Obsidian's REST and Websocket API.
View on PyPI
or
Read the Docs
A fully object-oriented wrapper around Obsidian v2 designed for discord.py.
This wrapper is based off of Slate.
This project was archived on the 28th of August, 2021. The library has been fundametally broken for the past few months and I have no plans to fix it. Consider using Slate or wavelink for replacements.
- 100% coverage
- Fully asynchronous
- Object oriented
- Playlist support
- Advanced audio filter support
- Querying tracks from many sources
- Spotify support
- Preset classes
- Fully typed
You can view documentation on the core library here.
First, we must download Obsidian itself.
The JAR located in current Obsidian respoitory is outdated, however the working build can be downloaded here.
You must have an obsidian.yml file before running Obsidian.
Create/download the file in the same directory as the JAR file (mentioned above).
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
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.
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')
The changelog has been moved to our documentation page.