add README; add CACHE_SIZE env var

This commit is contained in:
bain 2022-08-22 00:42:02 +02:00
parent dac5b43ba2
commit 7c8c5da5b2
No known key found for this signature in database
GPG key ID: A708F07AF3D92C02
4 changed files with 30 additions and 5 deletions

20
README Normal file
View file

@ -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.

View file

@ -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:

View file

@ -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"))

View file

@ -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