ari

discord music bot
git clone git://git.bain.cz/ari.git
Log | Files | Refs | README

commit 7c8c5da5b27278124e40f90d7fa2d19fc681933f
parent dac5b43ba29ca9bb7ebbe0f3cf550b080a6e9c3d
Author: bain <bain@bain.cz>
Date:   Mon, 22 Aug 2022 00:42:02 +0200

add README; add CACHE_SIZE env var

Diffstat:
AREADME | 20++++++++++++++++++++
Mari/bot.py | 4++--
Mari/constants.py | 4+---
Mdocker-compose.yml | 7+++++++
4 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/README b/README @@ -0,0 +1,20 @@ +Ari +> a discord music bot + +Ari is a simple music bot that communicates through reactions. You can +click the :play: reaction it adds to messages with youtube videos or +audio attachments to play its contents. + +When Ari fails to play a song, it adds a :download_error: reaction to the +message. You can click the reaction to get details on which songs Ari wasn't +able to play. + +It supports these commands: +`/skip <number>` - skips the number of songs. The number is optional + and defaults to 1. +`/stop` - tells Ari to disconnect. + + +To run your own Ari instance clone this repository (link in the header), +make sure you have docker and docker-compose installed, then fill in +`BOT_TOKEN` in docker-compose.yml, and run the compose file. diff --git a/ari/bot.py b/ari/bot.py @@ -6,7 +6,7 @@ from discord import app_commands from .player import Player -from .constants import BAINS_POSIT_NOTE, MUSIC_CACHE, Emoji +from .constants import CACHE_SIZE, MUSIC_CACHE, Emoji from .messages import MessageHandler from .cache import Cache @@ -25,7 +25,7 @@ class Bot(discord.Client): super().__init__(intents=intents) self.tree = app_commands.CommandTree(self) self.message_handler = MessageHandler(self) - self.music_cache = Cache(self.http, MUSIC_CACHE, max_size=300000000) + self.music_cache = Cache(self.http, MUSIC_CACHE, max_size=CACHE_SIZE) self.players: Dict[int, Player] = {} async def setup_hook(self) -> None: diff --git a/ari/constants.py b/ari/constants.py @@ -1,8 +1,5 @@ import os from typing import NamedTuple -import discord - -BAINS_POSIT_NOTE = discord.Object(id=630144683359862814) class Emoji(NamedTuple): @@ -15,3 +12,4 @@ class Emoji(NamedTuple): PRELOAD = bool(int(os.getenv("PRELOAD", "1"))) MUSIC_CACHE = os.getenv("MUSIC_CACHE", "cache") BOT_TOKEN = os.getenv("BOT_TOKEN", "invalid") +CACHE_SIZE = int(os.getenv("CACHE_SIZE", "300000000")) diff --git a/docker-compose.yml b/docker-compose.yml @@ -5,4 +5,11 @@ services: build: . environment: BOT_TOKEN: "" + # specify a cache dir + # MUSIC_CACHE: "cache" + # preload music in queue (disable if you have slow internet) + # PRELOAD: "1" + # max cache size in bytes + # CACHE_SIZE: 300000000 + tty: true