Skip to content

Commit

Permalink
Merge pull request #126 from ValgulNecron/dev
Browse files Browse the repository at this point in the history
V 2.9.2
  • Loading branch information
ValgulNecron authored Jun 18, 2024
2 parents 4ba56dd + 1ed9f1e commit f031673
Show file tree
Hide file tree
Showing 171 changed files with 15,190 additions and 4,825 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea/**/shelfz

# AWS User-specific
.idea/**/aws.xml
Expand Down
1 change: 1 addition & 0 deletions .env-default
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ 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)
DB_TYPE="sqlite" # Database type (sqlite or postgres)
CACHE_TYPE="in-memory" # Cache type (in-memory)

# Bot configuration
REMOVE_OLD_COMMAND="false" # Remove old commands on startup
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/gitleak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: gitleaks
on:
pull_request:
push:
workflow_dispatch:
schedule:
- cron: "0 4 * * *" # run once a day at 4 AM
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} # Only required for Organizations, not personal accounts.
35 changes: 0 additions & 35 deletions .github/workflows/linting.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/test-and-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: test and lint
on:
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Run clippy
run: cargo clippy --workspace --tests

- name: Run tests
run: cargo test --workspace

- name: Run fmt
run: cargo fmt --all -- --check
29 changes: 0 additions & 29 deletions .github/workflows/testing.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ images/**
cert
cert/**
command_use.json


random_stats.json
config.toml
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
Expand Down
14 changes: 10 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "kasuki"
version = "2.8.21"
version = "2.9.2"
edition = "2021"
authors = ["Valgul <contact@valgul.moe>"]
description = "A discord bot written in rust that get info from anilist API"
Expand All @@ -11,12 +11,12 @@ license-file = "LICENSE"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
regex = "1.10.4"
regex = "1.10.5"
reqwest = { version = "0.12.4", features = ["json", "multipart", "blocking"] }
serde = "1.0.203"
serde_json = "1.0.117"
serenity = { git = "https://github.com/serenity-rs/serenity.git", branch = "current", default-features = false, features = ["client", "gateway", "rustls_backend", "model", "utils", "full", "unstable_discord_api"] }
tokio = { version = "1.37.0", features = ["full"] }
tokio = { version = "1.38.0", features = ["full"] }
sqlx = { version = "0.7.4", features = ["sqlite", "runtime-tokio-native-tls", "postgres"] }
rand = "0.9.0-alpha.1"
chrono = "0.4.38"
Expand Down Expand Up @@ -44,11 +44,17 @@ tui-logger = "0.11.1"
rayon = "1.10.0"
os_info = "3.8.2"
rcgen = "0.13.1"
markdown_converter = "0.2.0"
markdown_converter = "0.3.4"
futures = "0.3.30"
rapidfuzz = "0.5.0"
cynic = { version = "3.7.3", features = ["reqwest", "http-reqwest", "serde_json"] }
moka = { version = "0.12.7", features = ["future"] }
toml = "0.8.14"

[build-dependencies]
tonic-build = "0.11.0"
cynic-codegen = { version = "3.7.3" }
insta = "1.39.0"

[profile.dev]
codegen-units = 512
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# This includes the Cargo.toml file which specifies the Rust dependencies.
COPY ./Cargo.toml ./Cargo.toml
COPY ./proto ./proto
COPY ./schemas ./schemas
COPY ./build.rs ./build.rs
# Build a dummy project
# This is done to cache the dependencies.
Expand Down
14 changes: 5 additions & 9 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,11 @@
- [X] User command
- [ ] Message command
- [ ] User installed app (waiting on serenity to support it).


- Fixing list:
- [ ] autocomplete steam game
- [ ] Federation
- [ ] Add a federation system to share data between bot.
- Should be able to share data between bot.
- Should be P2P.
- Should work with a "token" system to allow different "federation" to share different data.

- Optimisation needed:
- [ ] anilist_server list_user


- Anilist api builder:
- Need to add media connection to character.
- Need to add character, staff, studio, airing schedule, trends, reviews, recommendations connection to media.
10 changes: 10 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,15 @@ fn main() -> Result<(), Box<dyn Error>> {
.file_descriptor_set_path(out_dir.join("command_descriptor.bin"))
.compile(&["proto/command.proto"], &["proto"])?;
tonic_build::compile_protos("proto/command.proto")?;

tonic_build::configure()
.file_descriptor_set_path(out_dir.join("federation_descriptor.bin"))
.compile(&["proto/federation.proto"], &["proto"])?;
tonic_build::compile_protos("proto/federation.proto")?;

cynic_codegen::register_schema("anilist")
.from_sdl_file("schemas/anilist.graphql")?
.as_default()?;

Ok(())
}
54 changes: 2 additions & 52 deletions compose-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,12 @@ services:
container_name: kasuki
restart: unless-stopped
tty: true
environment:
# Discord Bot Configuration
- DISCORD_TOKEN=YourDiscordTokenHere # Discord bot token used for authentication [0][2]
- BOT_ACTIVITY=Let you get info from anilis. # Status message displayed when the bot is active

# OpenAI API Tokens and Base URLs
- AI_API_TOKEN=YourOpenAITokenHere # Token for making requests to the OpenAI API [12]
- AI_API_BASE_URL=https://api.openai.com/v1/ # Base URL for API requests; must end with a slash [12]

# Image Generation Settings
- AI_IMAGE_API_TOKEN=${AI_API_TOKEN} # Token specifically for image-related AI requests; defaults to AI_API_TOKEN if unset
- AI_IMAGE_API_BASE_URL=${AI_API_BASE_URL} # Base URL for image-related API requests; defaults to AI_API_BASE_URL if unset
- AI_IMAGE_GENERATION_MODELS=dall-e-3 # AI model(s) used for generating images; default is 'dall-e-3' [12]
- AI_IMAGE_QUALITY=hd # Quality level for generated images; typical options are 'ld', 'sd', 'hd', etc.
- AI_IMAGE_STYLE=vivid # Style preference for generated images; can vary depending on the model used
- AI_IMAGE_SIZE=1024x1024 # Dimensions of generated images; default is '1024x1024'

# Chatbot Configuration
- AI_CHAT_API_TOKEN=${AI_API_TOKEN} # Token for chat-related AI requests; defaults to AI_API_TOKEN if unset
- AI_CHAT_API_BASE_URL=${AI_API_BASE_URL} # Base URL for chat-related API requests; defaults to AI_API_BASE_URL if unset
- AI_CHAT_MODEL=gpt-3.5-turbo # AI model used for chat generation; default is 'gpt-3.5-turbo' [12]

# Transcription Configuration
- AI_TRANSCRIPT_API_TOKEN=${AI_API_TOKEN} # Token for transcription-related AI requests; defaults to AI_API_TOKEN if unset
- AI_TRANSCRIPT_BASE_URL=${AI_API_BASE_URL} # Base URL for transcription-related API requests; defaults to AI_API_BASE_URL if unset
- AI_TRANSCRIPT_MODELS=whisper-1 # AI model used for transcription generation; default is 'whisper-1' [12]

# Logging and Debugging Configuration
- RUST_LOG=info # Logging level for the application; can be 'trace', 'debug', 'info', 'warn', or 'error'
- MAX_LOG_RETENTION_DAYS=30 # Maximum number of days to retain logs

# Bot configuration
- REMOVE_OLD_COMMAND=false # Whether to remove old commands when the bot starts up
- DB_TYPE=sqlite # Type of database to use; either 'sqlite' or 'postgres'

# gRPC server configuration
- GRPC_IS_ON=true # Whether to enable the gRPC server for serving images and other content
- GRPC_PORT=443 # Port to use for the gRPC server (if enabled) (don't change this unless you know what you're doing)
- USE_SSL=true # Use SSL for gRPC server (don't change this unless you know what you're doing)
- SSL_CERT_PATH=cert/cert.pem # Path to SSL certificate (don't change this unless you know what you're doing)
- SSL_KEY_PATH=cert/key.pem # Path to SSL key (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:
- "443:443"
volumes:
- ./db/data.db:/kasuki/data.db
- ./db/cache.db:/kasuki/cache.db
- ./command_use.json:/kasuki/command_use.json
- ./db/data.db:/kasuki/db
- ./logs/:/kasuki/logs/
- ./server_image:/kasuki/server_image/
- ./cert:/kasuki/cert/
- ./config.toml:/kasuki/config.toml
- /etc/localtime:/etc/localtime:ro
Loading

0 comments on commit f031673

Please sign in to comment.