Skip to content

Commit

Permalink
Merge pull request #111 from ValgulNecron/dev
Browse files Browse the repository at this point in the history
V2.7.0
  • Loading branch information
ValgulNecron committed Apr 22, 2024
2 parents 8bf5bf3 + ff7d05d commit b1e8cc6
Show file tree
Hide file tree
Showing 168 changed files with 5,220 additions and 1,318 deletions.
1 change: 1 addition & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
sqlite3 curl zsh vim \
git gnupg2 jq sudo \
build-essential openssl \
protobuf-compiler \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /home/
Expand Down
34 changes: 32 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,43 @@
"dockerFile": "Dockerfile",
"customizations": {
"vscode": {
"extensions": [
"rust-analyzer.rust-analyzer",
"1YiB.rust-bundle",
"dustypomerleau.rust-syntax",
"swellaby.vscode-rust-test-adapter",
"GitHub.vscode-github-actions",
"ms-azuretools.vscode-docker",
"Catppuccin.catppuccin-vsc-icons",
"Catppuccin.catppuccin-vsc"
],
"settings": {
"editor.formatOnSave": true,
"extensions.ignoreRecommendations": false,
"rust-analyzer.completion.autoimport": true,
"rust-analyzer.lru.capacity": 10,
"rust-analyzer.completion.postfix.enable": true
"rust-analyzer.completion.postfix.enable": true,
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "/bin/zsh"
}
}
}
}
},
"features": {
"ghcr.io/devcontainers/features/rust:1": {
"version": "latest",
"profile": "complete"
},
"ghcr.io/lee-orr/rusty-dev-containers/rust_windows_msvc:0": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"moby": true,
"azureDnsAutoDetection": true,
"installDockerBuildx": true,
"installDockerComposeSwitch": true,
"version": "latest",
"dockerDashComposeVersion": "v2"
}
}
}
}
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ fabric.properties

# MSVC Windows builds of rustc generate these, which store debugging information

target/
target/

# ignore .gitkeep file in json directory and all its subdirectories
json/**/.gitkeep
12 changes: 9 additions & 3 deletions .env-default
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ AI_TRANSCRIPT_MODELS="whisper-1" # Model used for transcription generation (defa

# Logging and Debugging Configuration
RUST_LOG="info" # Level of logging (can be warn, error, info, debug, trace)
NSFW=true # Enable NSFW content processing
REMOVE_OLD_COMMAND=false # Remove old commands on startup
REMOVE_OLD_COMMAND="false" # Remove old commands on startup
DB_TYPE="sqlite" # Database type (sqlite or postgres)
MAX_LOG_RETENTION_DAYS=30 # Maximum number of days to retain logs

# web server configuration
GRPC_IS_ON="true" # Enable web server
GRPC_SERVER_PORT="8080" # Port for web server

# Media Saving Configuration
SAVE_IMAGE="local" # Where to save images (local, remote, false)
SAVE_SERVER="imgur" # Server to save media to (imgur, catbox)
TOKEN="ImgurClientIDOrCatboxUserHash" # Imgur client ID or Catbox user hash for authentication
TOKEN="ImgurClientIDOrCatboxUserHash" # Imgur client ID or Catbox user hash for authentication

# application configuration
TUI="true" # Enable the TUI interface
26 changes: 15 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kasuki"
version = "2.5.2"
version = "2.8.0"
edition = "2021"
authors = ["Valgul <contact@valgul.moe>"]
description = "A discord bot written in rust that get info from anilist API"
Expand All @@ -11,31 +11,36 @@ license-file = "LICENSE"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
regex = "1.10.3"
reqwest = { version = "0.11.24", features = ["json"] }
regex = "1.10.4"
reqwest = { version = "0.12.4", features = ["json", "multipart"] }
serde = "1.0.197"
serde_json = "1.0.114"
serde_json = "1.0.115"
serenity = { version = "0.12.1", default-features = false, features = ["client", "gateway", "rustls_backend", "model", "utils", "full"] }
tokio = { version = "1.36.0", features = ["full"] }
sqlx = { version = "0.7.3", features = ["sqlite", "runtime-tokio-native-tls", "postgres"] }
rand = "0.9.0-alpha.0"
chrono = "0.4.34"
uuid = { version = "1.7.0", features = ["v4"] }
sqlx = { version = "0.7.4", features = ["sqlite", "runtime-tokio-native-tls", "postgres"] }
rand = "0.9.0-alpha.1"
chrono = "0.4.35"
uuid = { version = "1.8.0", features = ["v4"] }
dotenv = "0.15.0"
image = "0.25.0-preview.0"
image = "0.25.0"
base64 = "0.22.0"
tracing = { version = "0.1.40" }
once_cell = "1.19.0"
tracing-subscriber = { version = "0.3.18", features = ["default", "env-filter"] }
tracing-core = "0.1.32"
serde_with = { version = "3.6.1", features = ["macros"] }
serde_with = { version = "3.7.0", features = ["macros"] }
rust-fuzzy-search = "0.1.1"
palette = "0.7.5"
catbox = "0.8.2"
imgurs = "0.11.2"
tracing-appender = "0.2.3"
tonic = "0.11.0"
prost = "0.12.3"
tonic-reflection = "0.11.0"
ratatui = "0.26.2"
crossterm = "0.27.0"
sysinfo = "0.30.11"
tui-logger = "0.11.0"

[build-dependencies]
tonic-build = "0.11.0"
Expand All @@ -46,5 +51,4 @@ codegen-units = 512

[profile.release]
lto = true
incremental = true
codegen-units = 8
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Supported Versions

The only supported version is the current master version
The only supported version are the current master version and the dev version

## Reporting a Vulnerability

To report the vulnerability please contact me to kasukisecurity@valgul.moe
To report the vulnerability please contact me to kasukisecurity@valgul.moe or on github
96 changes: 96 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
- Anilist module:
- [X] Finish comparison function.
- [X] Add affinity score to user comparaison.
- [X] Add character search function.
- [X] Add staff search function.
- [X] Add search feature with a type.
- [X] Bind anilist account to discord for /user.
- [X] Random /random {anime, manga}.
- [ ] Rework the xp in level.rs to something easier. — Too lazy to balance.
- [X] Add caching to all requests.
- [X] Send anime release to a channel.
- [X] List all activity.
- [X] Delete an activity.
- [ ] Try to do the same for manga.
with [https://www.mangaupdates.com/series.html?id=70263](https://www.mangaupdates.com/series.html?id=70263).
— Did some digging seem possible.
- [ ] Activity command (auto sends activity of a user to a channel).
— Same as anime, but this one will be hard since
a user can do update every second like every year. Will either have delay or be resource intensive.
- [X] Add a "delay" option to delay notification.
- [X] Take [https://anilist.co/forum/thread/64835](https://anilist.co/forum/thread/64835) idea of generating image
with a seiyuu and va role.
- [X] Get all the register users of the server.
- [X] Add studio search.
- [X] Add commands that give the best waifu.

- Anime module:
- [X] Command for a random anime image.
- [X] Command for a random anime image NSFW.

- Games module:
- [X] Search for a steam game.
- [ ] get game info from different platform (ubi (api not found), steam, epic(api not found), ea(api not found),
etc…)
Get the currency and language from the server language setting.
- [ ] get player stat
- [ ] get free promotion notification

- AI submodule:
- [X] Image generation with AI.
- [X] Video transcription.
- [X] Video translation.
- [X] Ask a question and reply the response.

- Music module:
- [ ] Play music from youtube.
- [ ] Play music from file upload.
- [ ] Play music from a link.
- [ ] Play music from a playlist.
- [ ] Play music from a search.

- General module:
- [X] Command to change the bot response langage.
- [X] Command to turn on and off module.
- [X] Credit command.
- [X] Bot info command.
- [X] Ping command.
- [X] Avatar command.
- [X] Banner command.
- [X] Command to recreate the server image from the guild member.
- [X] Command to recreate the server image from member off all guild the bot is on.
- [X] Get guild info.
- [X] Profile command.
- [ ] Upgrade get guild info to show more info.
- [ ] Poll feature with custom choice and a graph afterward for comparison.


- General part:
- [X] Add localisation.
- [X] Localisation for response.
- [X] Localisation for command.
- [X] Find a name for the bot.
- [x] Add a sqlite database.
- [X] Add postgres database choices.
- [X] Create a parser because some description uses html and not markdown.
- [ ] Check [https://anilist.co/forum/thread/6125](https://anilist.co/forum/thread/6125) to be sure all cases
are
supported
- [X] Figure out the necessary deps to work. Once found, change the dockerfile to use a debian base image to reduce
size.
- [X] Better error handling.
- [X] Doing something with error else than logging it.
- [ ] Rename function and variable for better clarity.
- [ ] Add docs to every public function.
(Run, Register and Autocomplete don’t need this.).
- [X] Logging
- [X] Updating to serenity 0.12.
- [X] Support for command in dm.
- [X] Make an anilist forum post.
- [ ] Rework the command registration to support all type of command.
- [X] Command
- [X] Subcommand
- [X] Subcommand group
- [ ] User command
- [ ] Message command

5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use std::error::Error;
use std::{env, path::PathBuf};

fn main() -> Result<(), Box<dyn Error>> {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
tonic_build::configure()
.file_descriptor_set_path(out_dir.join("shard_descriptor.bin"))
.compile(&["proto/shard.proto"], &["proto"])?;
tonic_build::compile_protos("proto/shard.proto")?;
Ok(())
}
9 changes: 9 additions & 0 deletions compose-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,19 @@ services:
- DB_TYPE="sqlite" # Type of database to use; either 'sqlite' or 'postgres'
- MAX_LOG_RETENTION_DAYS=30 # Maximum number of days to retain logs

# Web Server Configuration
- GRPC_IS_ON="true" # Whether to enable the web server for serving images and other content
- GRPC_PORT=8080 # Port to use for the web server (if enabled) (don't change this unless you know what you're doing)

# Media Saving Configuration
- SAVE_IMAGE="local" # Location to save images; can be 'local', 'remote', or 'false' to disable
- SAVE_SERVER="imgur" # Server to save media to; either 'imgur' or 'catbox'
- TOKEN="ImgurClientIDOrCatboxUserHash" # Authentication token for the chosen media saving server

# application configuration
- TUI="false" # Enable the TUI interface
ports:
- "8080:8080"
volumes:
- ./db/data.db:/kasuki/data.db
- ./db/cache.db:/kasuki/cache.db
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion json/command/ai.json → json/____old/ai.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ai",
"desc": "Command from the AI module",
"dm_command": false,
"dm_command": true,
"nsfw": false,
"perm": false,
"arg_num": 4,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,36 @@
"desc": "アニメ活動を追加します。"
}
]
},
{
"name": "delete_activity",
"desc": "Delete an anime activity.",
"command_type": "SubCommand",
"required": true,
"autocomplete": false,
"file": "anilist_admin/delete_activity.json",
"localised_args": [
{
"code": "en-US",
"name": "delete_activity",
"desc": "Delete an anime activity."
},
{
"code": "fr",
"name": "supprimer_activite",
"desc": "Supprimer une activité anime."
},
{
"code": "de",
"name": "aktivitat_loeschen",
"desc": "Löschen Sie eine Anime-Aktivität."
},
{
"code": "ja",
"name": "katsudo_wo_sakujo",
"desc": "アニメ活動を削除します。"
}
]
}
],
"localised": [
Expand Down
File renamed without changes.
Loading

0 comments on commit b1e8cc6

Please sign in to comment.