1.2.1 - Fixed Events and Tips

This commit is contained in:
Evann Regnault 2023-10-19 19:23:32 +02:00
parent 201336f8be
commit 8bbbb49f1b
7 changed files with 69 additions and 29 deletions

58
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,58 @@
name: Docker Build and Push with Version
on:
push:
branches:
- master
env:
DOCKER_REGISTRY: r.regnault.dev
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
PORTAINER_API_WEBHOOK: ${{ secrets.PORTAINER_API_WEBHOOK }}
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Install cargo-semver
uses: actions-rs/install@v0.1.2
with:
crate: cargo-get
version: latest
- name: Semver
run:
echo "VERSION=$(cargo get package.version --pretty)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ env.DOCKER_REGISTRY }}/drunk-venti-rust:latest
${{ env.DOCKER_REGISTRY }}/drunk-venti-rust:${{ env.VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy to production
uses: fjogeleit/http-request-action@v1.14.1
with:
url: ${{ format('{0}?BOT-TAG={1}',env.PORTAINER_API_WEBHOOK, env.VERSION) }}
method: 'POST'
preventFailureOnNoResponse: true

View file

@ -1,22 +0,0 @@
name: Rust
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run test
run: cargo test --verbose

View file

@ -1,6 +1,6 @@
[package]
name = "drunk-venti-rust"
version = "1.2.0"
version = "1.2.1"
edition = "2021"
authors = ["Evann Regnault"]
license = "MIT"

View file

@ -26,7 +26,7 @@ pub struct Role{
pub main_stats: RoleStat,
pub sub_stats: Vec<Box<str>>,
pub talent: Vec<Box<str>>,
pub tip: Box<str>,
pub tip: Option<String>,
pub note: Box<str>,
pub name: Box<str>,
}

View file

@ -395,9 +395,13 @@ async fn note_embed(role: &Role, character: Character) -> CreateEmbed {
}
};
let n = &role.tip;
let a = role.tip.as_ref();
{
let x = n.split('\n');
let y = match a {
None => { String::from("")}
Some(b) => { b.to_string() }
};
let x = y.split('\n');
let mut first = true;
let mut add_before = "";
for tip_paragraph in x.collect::<Vec<&str>>() {

View file

@ -161,7 +161,7 @@ async fn create_status_embed() -> Vec<CreateEmbed> {
upcoming_embed.color(Colour::new(rand::thread_rng().gen_range(0x000000..0xffffff)));
if let Some(url) = &e.image {
upcoming_embed.image(format!("https://github.com/MadeBaruna/paimon-moe/raw/main/static/images/events/{}", url));
upcoming_embed.image(format!("https://github.com/MadeBaruna/paimon-moe/raw/main/static/images/events/{}", url.replace(' ', "%20")));
};
if let Some(url) = &e.url { upcoming_embed.url(format!("{}{}", url, question_marks)); };

View file

@ -135,7 +135,7 @@ impl EventHandler for Handler {
}
fn test_environment() {
env::var("DISCORD_TOKEN").expect("DISCORD_TOKEN needed");
env::var("TOKEN").expect("TOKEN needed");
env::var("MONGO_HOST").expect("MONGO_HOST needed");
env::var("MONGO_PORT").expect("MONGO_PORT needed");
env::var("API_HOST").expect("API_HOST needed");
@ -146,7 +146,7 @@ fn test_environment() {
async fn main() {
dotenv().ok();
test_environment();
let token= env::var("DISCORD_TOKEN").unwrap();
let token= env::var("TOKEN").unwrap();
let application_id: u64 = "860553396578811914".parse().expect("Wrong format");
let needed_intents = [