Skip to content

Commit

Permalink
Merge pull request #97 from ValgulNecron/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ValgulNecron committed Dec 22, 2023
2 parents 7198c2f + 50c8600 commit 8c4dfb0
Show file tree
Hide file tree
Showing 33 changed files with 274 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64/v8, linux/arm/v7, linux/386
platforms: linux/amd64,linux/arm64/v8
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/kasuki:dev
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-image-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64/v8
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/kasuki:latest
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/docker-image-v2.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ reqwest = { version = "0.11.22", features = ["json"] }
serde = "1.0.193"
serde_json = "1.0.108"
serenity = { version = "0.12.0", default-features = false, features = ["client", "gateway", "rustls_backend", "model", "utils", "full"] }
tokio = { version = "1.34.0", features = ["full"] }
tokio = { version = "1.35.1", features = ["full"] }
sqlx = { version = "0.7.3", features = ["sqlite", "runtime-tokio-native-tls"] }
rand = "0.8.5"
chrono = "0.4.31"
Expand All @@ -27,7 +27,7 @@ dotenv = "0.15.0"
image = "0.24.7"
base64 = "0.21.5"
tracing = { version = "0.1.40" }
once_cell = "1.18.0"
once_cell = "1.19.0"
tracing-subscriber = { version = "0.3.18", features = ["default", "env-filter"] }
tracing-core = "0.1.32"

Expand Down
Binary file modified data.db
Binary file not shown.
30 changes: 30 additions & 0 deletions json/command/guild.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "guild",
"desc": "Get information on the guild.",
"dm_command": false,
"nsfw": false,
"perm": false,
"arg_num": 0,
"localised": [
{
"code": "en-US",
"name": "guild",
"desc": "Get information on the guild."
},
{
"code": "fr",
"name": "guilde",
"desc": "Obtenir des informations sur la guilde."
},
{
"code": "de",
"name": "gilde",
"desc": "Erhalten Sie Informationen über die Gilde."
},
{
"code": "ja",
"name": "ギルド",
"desc": "ギルドの情報を取得します。"
}
]
}
2 changes: 1 addition & 1 deletion json/command/random.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "random",
"desc": "Get a random manga or anime.",
"dm_command": false,
"dm_command": true,
"nsfw": false,
"perm": false,
"arg_num": 1,
Expand Down
18 changes: 18 additions & 0 deletions json/message/general/guild.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"en": {
"title": "Guild",
"desc": "The guild name is $name$. \n It was created on $date$. \n It has $number$ member(s) out of $max$"
},
"fr": {
"title": "Guilde",
"desc": "Le nom de la guilde est $name$. \n Elle a été créée le $date$. \n Elle a $number$ membre(s) sur $max$"
},
"jp": {
"title": "ギルド",
"desc": "ギルドの名前は$name$です。 \n 作成日は$date$です。 \n メンバー数は$max$人中$number$人です"
},
"de": {
"title": "Gilde",
"desc": "Der Gildenname ist $name$. \n Sie wurde am $date$ erstellt. \n Sie hat $number$ Mitglied(er) von $max$"
}
}
28 changes: 14 additions & 14 deletions json/message/general/info.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
{
"en": {
"title": "Info",
"desc": "This bot uses the AniList API to provide information on a show or a user.",
"desc": "This bot uses the AniList API to provide information on a show or a user. \n The bot is on $number$ server. \n The bot version is: $version$",
"footer": "Creator: valgul.",
"button_see_on_github": "See on GitHub",
"button_official_website": "Official website",
"button_official_discord": "Official Discord",
"button_add_the_bot": "Add the bot"
},
"fr": {
"title": "Info",
"desc": "Ce bot utilise l'API AniList pour fournir des informations sur une émission ou un utilisateur.",
"footer": "Créateur: valgul.",
"title": "Informations",
"desc": "Ce bot utilise l'API AniList pour fournir des informations sur une série ou un utilisateur. \n Le bot est sur $number$ serveur. \n La version du bot est : $version$",
"footer": "Créateur : valgul.",
"button_see_on_github": "Voir sur GitHub",
"button_official_website": "Site officiel",
"button_official_discord": "Discord officiel",
"button_add_the_bot": "Ajouter le bot"
},
"jp": {
"title": "情報",
"desc": "このボットはAniList APIを使用して、ショーまたはユーザーの情報を提供します。",
"footer": "作成者: valgul.",
"desc": "このボットはAniList APIを使用して番組やユーザーの情報を提供します。 \n ボットは$number$サーバーにいます。 \n ボットのバージョンは:$version$",
"footer": "作成者valgul",
"button_see_on_github": "GitHubで見る",
"button_official_website": "公式ウェブサイト",
"button_official_discord": "公式Discord",
"button_add_the_bot": "ボットを追加する"
"button_add_the_bot": "ボットを追加"
},
"de": {
"title": "Info",
"desc": "Dieser Bot verwendet die AniList API, um Informationen über eine Show oder einen Benutzer bereitzustellen.",
"footer": "Ersteller: valgul.",
"button_see_on_github": "Auf GitHub anzeigen",
"button_official_website": "Offizielle Webseite",
"button_official_discord": "Offizielle Discord",
"button_add_the_bot": "Den Bot hinzufügen"
"desc": "Dieser Bot verwendet die AniList API, um Informationen zu einer Show oder einem Benutzer bereitzustellen. \n Der Bot ist auf $number$ Server. \n Die Bot-Version ist: $version$",
"footer": "Schöpfer: valgul.",
"button_see_on_github": "Auf GitHub ansehen",
"button_official_website": "Offizielle Website",
"button_official_discord": "Offizieller Discord",
"button_add_the_bot": "Bot hinzufügen"
}
}
}
96 changes: 39 additions & 57 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,87 +113,69 @@ cargo run --release
## BOT

- General part:
- [X] Change how the text is displayed to support localization. — Done.
- [X] Clean the code. — It will never be done.
can be called done for now.
- [X] Find a name for the bot. — Found one kasuki. if you have any better, don't hesitate to recommend.
- [x] Add a bdd for some stuff prob sqlite but not sure. — Added sqlite db. (change to PostgreSQL)
— will add a var variable that will either be "sqlite" or "postgresql" with a url var for PostgreSQL
— will need to do some change and move db logic to it's own funtion.
- [X] Banner. Show your or a specified user banner. — Done.
- [X] Profil. Show a user profile and some info. — Done.
- [X] Avatar. show you the profile picture of a user. — Done
- [X] Add support to turn on and off module. — Done.
- [X] Create a parser because some desc uses html and not markdown. — Done. Will need to check to be sure all is
done.
- [X] Change how the text is displayed to support localization.
- [X] Find a name for the bot.
- [x] Add a bdd for some stuff prob sqlite but not sure. — Added sqlite db. (change to PostgresSQL)
— will add a var variable that will either be "sqlite" or "postgresql" with an url var for PostgreSQL
— will need to do some change and move db logic to its own function.
- [X] Banner. Show your or a specified user banner.
- [X] Profil. Show a user profile and some info.
- [X] Avatar. show you the profile picture of a user.
- [X] Add support to turn on and off module.
- [X] Create a parser because some description uses html and not markdown.
Will need to check to be sure all are done.
- [ ] Poll feature with custom choice and a graph afterward for comparison.
- [X] Figure out the necessary deps to work. Once found, change the dockerfile to use a debian base image to reduce
size — Done.
size.
- [ ] Better error handling.
Different error messages,
type and replies everytime not in certain condition.
— working on it.
Should be okay believe there is still some risk of panic will need to see in the long term.
- [ ] Localisation for response — Done except for some other "minor" stuff. Lazy to continue will need some help to
proofread the json file and continue to complete the not finished one.
- [ ] Localisation for command — Working on it. Compare will be done later. Lazy to continue will need some help to
proofread the json file and continue to complete the not finished one.
- [ ] Rename function, structure, command name etc... so it makes more sense. Doing it should be good atm.
- [ ] Add docs to every public function. (Run, Register and Autocomplete do not need this.). started and clearly not
- [X] Localisation for command.
- [X] Rename function, structure, command name etc... so it makes more sense.
- [ ] Add docs to every public function.
(Run, Register and Autocomplete don’t need this.).
started and clearly not
finished.
- [X] Logging
- [X] Updating to serenity 0.12 — Working on it.
- [X] Support for command in dm (would need a rewrite on the langage part to default to en even when there is no guild
id) — Now working.
(for the command I want to be on in dm)
- [ ] Make an anilist forum post (when v2 is done);
- [X] Support for command in dm.
- [X] Make an anilist forum post.

- Anime submodule:
- [X] Finish comparison function.
— V1 done. — Will need to be better, but it works.
Ideas of improvement add a score on
how close two people are (affinity score).
— And have better formatting for the text.
- [X] Add character search function. — Added character research with name.
- [X] Add staff search function. — Added staff research with name.
- [X] Add search feature with a type. — Work for all.
- [X] Bind anilist account to discord for /user. — Added register command and edited user command.
- [X] Random /random {anime, manga}. — Added random for both anime and manga. Manga random can give ln.
- [ ] Rework the xp in struct_level to something easier. — Too lazy to balance
- [X] Add caching to all requests. — Done now will need to rework random.rs cause it double cache. 3days cache
except
for "high" priority request like user data.
- [X] Finish comparison function.
- [ ] 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 struct_level to something easier. — Too lazy to balance.
- [X] Add caching to all requests.
- [X] Send anime release to a channel.
— Done
- [ ] List all activity
- [ ] List all activity.
- [ ] 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)
(for
this one only selected manga not all seasonal).
— Did some digging seem possible. I will do anime-first trough.
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.
— (like 1h for a translation).
— Need anime notification first.
it will be easy once anime is done. On wait but will be done
- [X] Take [https://anilist.co/forum/thread/64835](https://anilist.co/forum/thread/64835)
idea of generating image
with a seiyuu and va role.
— This is possible, I'm not competent enough.
— Done
- [X] Take [https://anilist.co/forum/thread/64835](https://anilist.co/forum/thread/64835) idea of generating image with a seiyuu and va role.
- [ ] Get all the register users of the server.
Working on it after finishing anime activity.
Working on it after finishing anime activity.
- [X] Add studio search.
- [X] Add commands that give the best waifu. — Done.
- [X] Add commands that give the best waifu.

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

- Moderation submodule:
- [ ] General moderation stuff
Expand Down
4 changes: 2 additions & 2 deletions src/command_run/anilist/seiyuu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ use serenity::all::{
CommandDataOption, CommandInteraction, Context, CreateAttachment, CreateEmbed,
CreateInteractionResponseFollowup, CreateInteractionResponseMessage, Timestamp,
};
use tracing::{debug, error, trace};
use tracing::{debug, error};
use uuid::Uuid;

use crate::anilist_struct::run::seiyuu::{StaffImageNodes, StaffImageWrapper};
use crate::constant::{COLOR, COMMAND_SENDING_ERROR, DIFFERED_COMMAND_SENDING_ERROR};
use crate::error_enum::AppError;
use crate::error_enum::AppError::{
DifferedCreatingImageError, DifferedFailedToGetBytes, DifferedFailedUrlError,
DifferedReadingFileError, DifferedWritingFile,
DifferedWritingFile,
};
use crate::lang_struct::anilist::seiyuu::load_localization_seiyuu;

Expand Down
8 changes: 4 additions & 4 deletions src/command_run/anilist/staff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ pub async fn run(
.nodes
.iter()
.filter_map(|x| {
let full = x.name.full.as_ref().map(|s| s.as_str());
let native = x.name.native.as_ref().map(|s| s.as_str());
let full = x.name.full.as_deref();
let native = x.name.native.as_deref();
match (full, native) {
(Some(full), Some(native)) => Some(format!("{}/{}", full, native)),
(Some(full), None) => Some(full.to_string()),
Expand All @@ -146,8 +146,8 @@ pub async fn run(
.edges
.iter()
.filter_map(|x| {
let romaji = x.node.title.romaji.as_ref().map(|s| s.as_str());
let english = x.node.title.english.as_ref().map(|s| s.as_str());
let romaji = x.node.title.romaji.as_deref();
let english = x.node.title.english.as_deref();
match (romaji, english) {
(Some(romaji), Some(english)) => Some(format!("{}/{}", romaji, english)),
(Some(romaji), None) => Some(romaji.to_string()),
Expand Down
4 changes: 2 additions & 2 deletions src/command_run/anilist/studio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub async fn run(
let mut value = String::new();
for option_data in options {
if option_data.name.as_str() != "type" {
let option_value = option_data.value.as_str().clone().unwrap();
let option_value = option_data.value.as_str().unwrap();
value = option_value.to_string().clone()
}
}
Expand All @@ -42,7 +42,7 @@ pub async fn run(
let en = title.user_preferred;
let text = format!("[{}/{}]({})", rj, en, m.site_url);
content.push_str(text.as_str());
content.push_str("\n");
content.push('\n');
}

let desc = studio_localised
Expand Down
Loading

0 comments on commit 8c4dfb0

Please sign in to comment.