Skip to content

Commit

Permalink
Release version 3.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
regunakyle committed Jul 3, 2024
2 parents eeb2332 + c8fc5fc commit 1707067
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 199 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ COPY --from=compile-image /bin/ffmpeg /bin/ffmpeg

# Override system Python with the one in venv
ENV PATH=/opt/venv/bin:$PATH \
XDG_CONFIG_HOME=/app/volume
XDG_CACHE_HOME=/app/volume

WORKDIR /app

Expand Down
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,31 @@ This Discord bot is developed with Python 3.11. Use the same Python version to e

4. Run `python main.py` in your console to start up the bot.

5. To use the music player, you need to run a [Lavalink](https://github.com/freyacodes/Lavalink) instance alongside the bot.

The config for Lavalink can be found in `.env`.
5. To use the music player, you need to run a [Lavalink](https://github.com/freyacodes/Lavalink) instance alongside the bot. Set `LAVALINK_URL` and `LAVALINK_PASSWORD` in `.env`.

Example config file (`application.yml`) for Lavalink:

```yaml
server:
port: 2333
address: 0.0.0.0
plugins:
youtube:
enabled: true
clients:
- MUSIC
- ANDROID
- WEB
- TVHTML5EMBEDDED
lavalink:
plugins:
# See https://github.com/lavalink-devs/youtube-source for the latest version of the plugin
- dependency: "dev.lavalink.youtube:youtube-plugin:1.3.0"
server:
password: "youshallnotpass"
sources:
youtube: false
```
6. To use the AI chat command, set `OPENAI_API_KEY` and `OPENAI_MODEL_NAME` in `.env`.

Expand All @@ -40,7 +62,7 @@ Note: The `latest` tag refers to the latest stable version.
- [ ] Music.play: Add Spotify support
- [ ] General.pixiv: Rewrite (refer to Phixiv implementation)
- [ ] AI.draw: Add [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) support
- [ ] Docker support iGPU for FFMPEG
- [ ] Allow passing arguments to FFMPEG (for hardware acceleration)
- [ ] Allow bot owner to run every command (including admin only commands)

## Notable commands
Expand Down Expand Up @@ -84,7 +106,7 @@ The list below only shows a subset of commands which I think need further explan
Start the discord bot container, then run in console:

1. `docker exec -it <container-name-or-id> /bin/bash`
2. `gallery-dl oauth:pixiv -o browser=`
2. `gallery-dl oauth:pixiv`
3. Follow the instructions given

### `/connect_music`
Expand All @@ -95,7 +117,7 @@ The list below only shows a subset of commands which I think need further explan

Do NOT use this command while the bot is playing music!

- Lavalink can be unstable (probably because YouTube often changes their Innertube API).
- Lavalink can be unstable (probably because YouTube changes their Innertube API often).

If the music player consistently produce errors, go to the Lavalink discord to check if there is a hotfix version of Lavalink.

Expand Down
5 changes: 0 additions & 5 deletions assets/gallery-dl/config.json

This file was deleted.

6 changes: 0 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
import logging
import os
import shutil
from logging.handlers import TimedRotatingFileHandler
from pathlib import Path

Expand All @@ -21,11 +20,6 @@ async def main() -> None:
# Initialization
Path("./volume/logs").mkdir(parents=True, exist_ok=True)
Path("./volume/gallery-dl").mkdir(parents=True, exist_ok=True)
if not Path("./volume/gallery-dl/config.json").is_file():
try:
shutil.copy2("./assets/gallery-dl/config.json", "./volume/gallery-dl")
except Exception:
pass

# Logger
logger = logging.getLogger()
Expand Down
194 changes: 103 additions & 91 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "my-discord-bot"
version = "3.1.1"
version = "3.1.2"
description = "Discord Bot by Reguna"
authors = ["Reguna <60984878+regunakyle@users.noreply.github.com>"]
package-mode = false
Expand Down
181 changes: 95 additions & 86 deletions requirements.txt

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/cogs/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

logger = logging.getLogger(__name__)

# TODO: Handle bad connections


class AI(CogBase):
def __init__(
Expand Down
5 changes: 2 additions & 3 deletions src/cogs/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ async def pixiv(
# Delay response, maximum 15 mins
await ia.response.defer()

# Load Gallery-DL config and set maximum file size
config.load(("./volume/gallery-dl/config.json",))
# TODO: Add encoder config
config.set(
("downloader",),
"filesize-max",
Expand Down Expand Up @@ -130,7 +129,7 @@ async def pixiv(
case 16:
# AuthenticationError: No token provided
await ia.followup.send(
"Cannot login to Pixiv. Please notify the bot owner! \nBot owner: Please find instructions in https://github.com/regunakyle/my-discord-bot#pixiv-pixiv_link-image_number."
"Cannot login to Pixiv. Please notify the bot owner! \nTo the bot owner: Please find instructions in https://github.com/regunakyle/my-discord-bot#important-you-must-have-ffmepg-installed-and-setup-an-oauth-token-to-use-this-command"
)
return
case _:
Expand Down

0 comments on commit 1707067

Please sign in to comment.