mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-22 09:34:21 +00:00
Compare commits
9 commits
8ae11125ed
...
2c1f710d9d
Author | SHA1 | Date | |
---|---|---|---|
2c1f710d9d | |||
9e4689c53d | |||
65ce804c91 | |||
d33831ea3c | |||
8467d7e2d5 | |||
0c86ecd40d | |||
04d4ad46a1 | |||
d61ca9b288 | |||
cf4adc4024 |
13 changed files with 748 additions and 672 deletions
1278
Cargo.lock
generated
1278
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "patched_porobot"
|
||||
version = "0.15.0"
|
||||
version = "1.0.1"
|
||||
authors = ["Stefano Pigozzi <me@steffo.eu>"]
|
||||
edition = "2021"
|
||||
description = "Legends of Runeterra card database utilities and bots"
|
||||
|
@ -46,7 +46,6 @@ rand = { version = "0.8.5", optional = true }
|
|||
# discord
|
||||
serenity = { version = "0.11.5", features = ["client", "cache", "gateway", "rustls_backend", "model"], default-features = false, optional = true }
|
||||
anyhow = { version = "^1.0.68", optional = true }
|
||||
# matrix
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -60,7 +59,6 @@ exec = ["pretty_env_logger"]
|
|||
search = ["tantivy"]
|
||||
telegram = ["exec", "search", "jpg", "teloxide", "tokio", "md5", "rand"]
|
||||
discord = ["exec", "search", "serenity", "tokio", "anyhow"]
|
||||
matrix = ["exec", "search"]
|
||||
|
||||
|
||||
[lib]
|
||||
|
@ -73,7 +71,3 @@ required-features = ["telegram"]
|
|||
[[bin]]
|
||||
name = "patched_porobot_discord"
|
||||
required-features = ["discord"]
|
||||
|
||||
[[bin]]
|
||||
name = "patched_porobot_matrix"
|
||||
required-features = ["matrix"]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM --platform=${BUILDPLATFORM} rust:1.68-bullseye AS builder
|
||||
FROM --platform=${BUILDPLATFORM} rust:1.81-bookworm AS builder
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
|
@ -60,7 +60,7 @@ RUN \
|
|||
|
||||
#############################################################################
|
||||
|
||||
FROM --platform=${TARGETPLATFORM} rust:1.68-slim-bullseye AS final
|
||||
FROM --platform=${TARGETPLATFORM} rust:1.81-slim-bookworm AS final
|
||||
|
||||
WORKDIR /usr/src/patched_porobot/
|
||||
COPY --from=builder \
|
||||
|
|
|
@ -13,10 +13,6 @@ Legends of Runeterra game data crate and chat bots
|
|||
[![Telegram Bot](https://img.shields.io/badge/telegram%20bot-done-success)](https://t.me/patchedporobot)
|
||||
|
||||
[![Discord Bot](https://img.shields.io/badge/discord%20bot-done-success)](https://discord.com/api/oauth2/authorize?client_id=1071989978743193672&scope=applications.commands)
|
||||
|
||||
![Matrix Bot](https://img.shields.io/badge/matrix%20bot-to%20do-inactive)
|
||||
|
||||
![Fediverse Bot](https://img.shields.io/badge/fediverse%20bot-to%20do-inactive)
|
||||
|
||||
[![Crates.io](https://img.shields.io/crates/v/patched_porobot)](https://crates.io/crates/patched_porobot)
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
//! This bot isn't yet available.
|
||||
|
||||
#![doc(html_logo_url = "https://raw.githubusercontent.com/Steffo99/patched-porobot/main/icon.png")]
|
||||
|
||||
fn main() {
|
||||
todo!();
|
||||
}
|
|
@ -118,8 +118,8 @@ mod tests {
|
|||
};
|
||||
}
|
||||
|
||||
test_fetch!(test_fetch_4_9_0_en_us, "4_9_0", "en_us");
|
||||
test_fetch!(test_fetch_4_9_0_it_it, "4_9_0", "it_it");
|
||||
test_fetch!(test_fetch_5_9_0_en_us, "5_9_0", "en_us");
|
||||
test_fetch!(test_fetch_5_9_0_it_it, "5_9_0", "it_it");
|
||||
test_fetch!(test_fetch_latest_en_us, "latest", "en_us");
|
||||
|
||||
macro_rules! test_supported {
|
||||
|
@ -140,7 +140,7 @@ mod tests {
|
|||
};
|
||||
}
|
||||
|
||||
test_supported!(test_supported_4_9_0_en_us, "4_9_0", "en_us");
|
||||
test_supported!(test_supported_4_9_0_it_it, "4_9_0", "it_it");
|
||||
test_supported!(test_supported_5_9_0_en_us, "5_9_0", "en_us");
|
||||
test_supported!(test_supported_5_9_0_it_it, "5_9_0", "it_it");
|
||||
test_supported!(test_supported_latest_en_us, "latest", "en_us");
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ impl CardArt {
|
|||
fn imgproxy_convert_to_jpg(url: &str) -> String {
|
||||
use base64::Engine;
|
||||
|
||||
let url = url.replace("http:", "https:");
|
||||
let url = base64::prelude::BASE64_URL_SAFE.encode(url);
|
||||
let url = format!("/{url}.jpg");
|
||||
|
||||
|
|
|
@ -220,10 +220,11 @@ pub enum CardKeyword {
|
|||
Fated,
|
||||
|
||||
#[serde(alias = "BlocksElusive")]
|
||||
/// ???
|
||||
#[serde(alias = "BlockElusive")]
|
||||
/// Sharpsight.
|
||||
///
|
||||
/// > Can block Elusive units.
|
||||
BlockElusive,
|
||||
Sharpsight,
|
||||
|
||||
/// Fury.
|
||||
///
|
||||
|
@ -331,6 +332,11 @@ pub enum CardKeyword {
|
|||
///
|
||||
/// > Can only be blocked by enemies with 3 or more Power.
|
||||
Fearsome,
|
||||
|
||||
/// Deathless.
|
||||
///
|
||||
/// > The next time this unit dies, remove Deathless and revive it Stunned with 1 Health.
|
||||
Deathless,
|
||||
|
||||
/// Can't Block.
|
||||
CantBlock,
|
||||
|
@ -371,6 +377,23 @@ pub enum CardKeyword {
|
|||
|
||||
/// ???
|
||||
Freljord,
|
||||
|
||||
/// > Activatable once per round. When activated, play the skill of the current Act at Focus speed, then transform me to the next Act.
|
||||
#[serde(rename = "Story:Focus")]
|
||||
StoryFocus,
|
||||
|
||||
/// > Activatable once per round. When activated, play the skill of the current Act at Slow speed, then transform me to the next Act.
|
||||
#[serde(rename = "Story:Slow")]
|
||||
StorySlow,
|
||||
|
||||
/// > Applies a negative effect as long as it's in hand. Multiples of the same curse on a unit combine, increasing their cost and effect. Cannot be targeted in hand.
|
||||
Curse,
|
||||
|
||||
/// This unit has +1|+1. This keyword can stack.
|
||||
Spirit,
|
||||
|
||||
/// > This unit has -1|-1. This keyword can stack.
|
||||
Gloom,
|
||||
|
||||
/// Unsupported card keyword.
|
||||
#[serde(other)]
|
||||
|
@ -464,12 +487,18 @@ impl CardKeyword {
|
|||
CardKeyword::Nightfall => "",
|
||||
CardKeyword::Daybreak => "",
|
||||
CardKeyword::Plunder => "",
|
||||
CardKeyword::BlockElusive => "",
|
||||
CardKeyword::Sharpsight => "",
|
||||
CardKeyword::Flow => "",
|
||||
CardKeyword::Capture => "<:capture:1056024295190577153>",
|
||||
CardKeyword::Attack => "",
|
||||
CardKeyword::ElementalSkill => "<:elementalskill:1165762476974026814>",
|
||||
CardKeyword::LevelUp => "",
|
||||
CardKeyword::StoryFocus => "", // TODO
|
||||
CardKeyword::StorySlow => "", // TODO
|
||||
CardKeyword::Spirit => "", // TODO
|
||||
CardKeyword::Gloom => "", // TODO
|
||||
CardKeyword::Curse => "", // TODO
|
||||
CardKeyword::Deathless => "", // TODO
|
||||
CardKeyword::Freljord => "<:freljord:1056024331437735936>",
|
||||
CardKeyword::Unsupported => "<:invaliddeck:1056022952396730438>",
|
||||
}
|
||||
|
@ -538,8 +567,9 @@ mod tests {
|
|||
test_deserialization!(deserialize_elusive, r#""Elusive""#, CardKeyword::Elusive);
|
||||
test_deserialization!(deserialize_stun, r#""Stun""#, CardKeyword::Stun);
|
||||
test_deserialization!(deserialize_fated, r#""Fated""#, CardKeyword::Fated);
|
||||
test_deserialization!(deserialize_blockelusive, r#""BlockElusive""#, CardKeyword::BlockElusive);
|
||||
test_deserialization!(deserialize_blockelusive2, r#""BlocksElusive""#, CardKeyword::BlockElusive);
|
||||
test_deserialization!(deserialize_blockelusive, r#""BlockElusive""#, CardKeyword::Sharpsight);
|
||||
test_deserialization!(deserialize_blockelusive2, r#""BlocksElusive""#, CardKeyword::Sharpsight);
|
||||
test_deserialization!(deserialize_sharpsight, r#""Sharpsight""#, CardKeyword::Sharpsight);
|
||||
test_deserialization!(deserialize_fury, r#""Fury""#, CardKeyword::Fury);
|
||||
test_deserialization!(deserialize_barrier, r#""Barrier""#, CardKeyword::Barrier);
|
||||
test_deserialization!(deserialize_immobile, r#""Immobile""#, CardKeyword::Immobile);
|
||||
|
@ -570,5 +600,11 @@ mod tests {
|
|||
test_deserialization!(deserialize_elementalskill, r#""ElementalSkill""#, CardKeyword::ElementalSkill);
|
||||
test_deserialization!(deserialize_levelup, r#""LevelUp""#, CardKeyword::LevelUp);
|
||||
test_deserialization!(deserialize_freljord, r#""Freljord""#, CardKeyword::Freljord);
|
||||
test_deserialization!(deserialize_curse, r#""Curse""#, CardKeyword::Curse);
|
||||
test_deserialization!(deserialize_spirit, r#""Spirit""#, CardKeyword::Spirit);
|
||||
test_deserialization!(deserialize_gloom, r#""Gloom""#, CardKeyword::Gloom);
|
||||
test_deserialization!(deserialize_deathless, r#""Deathless""#, CardKeyword::Deathless);
|
||||
test_deserialization!(deserialize_storyslow, r#""Story:Slow""#, CardKeyword::StorySlow);
|
||||
test_deserialization!(deserialize_storyfocus, r#""Story:Focus""#, CardKeyword::StoryFocus);
|
||||
test_deserialization!(deserialize_unsupported, r#""Xyzzy""#, CardKeyword::Unsupported);
|
||||
}
|
||||
|
|
|
@ -96,27 +96,29 @@ mod tests {
|
|||
};
|
||||
}
|
||||
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set1, "4_9_0", "en_us", "set1");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set2, "4_9_0", "en_us", "set2");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set3, "4_9_0", "en_us", "set3");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set4, "4_9_0", "en_us", "set4");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set5, "4_9_0", "en_us", "set5");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set6, "4_9_0", "en_us", "set6");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set6cde, "4_9_0", "en_us", "set6cde");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set7, "4_9_0", "en_us", "set7");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set7b, "4_9_0", "en_us", "set7b");
|
||||
test_fetch!(test_fetch_4_9_0_en_us_set8, "4_9_0", "en_us", "set8");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set1, "5_9_0", "en_us", "set1");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set2, "5_9_0", "en_us", "set2");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set3, "5_9_0", "en_us", "set3");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set4, "5_9_0", "en_us", "set4");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set5, "5_9_0", "en_us", "set5");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set6, "5_9_0", "en_us", "set6");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set6cde, "5_9_0", "en_us", "set6cde");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set7, "5_9_0", "en_us", "set7");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set7b, "5_9_0", "en_us", "set7b");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set8, "5_9_0", "en_us", "set8");
|
||||
test_fetch!(test_fetch_5_9_0_en_us_set9, "5_9_0", "en_us", "set9");
|
||||
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set1, "4_9_0", "it_it", "set1");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set2, "4_9_0", "it_it", "set2");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set3, "4_9_0", "it_it", "set3");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set4, "4_9_0", "it_it", "set4");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set5, "4_9_0", "it_it", "set5");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set6, "4_9_0", "it_it", "set6");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set6cde, "4_9_0", "it_it", "set6cde");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set7, "4_9_0", "it_it", "set7");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set7b, "4_9_0", "it_it", "set7b");
|
||||
test_fetch!(test_fetch_4_9_0_it_it_set8, "4_9_0", "it_it", "set8");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set1, "5_9_0", "it_it", "set1");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set2, "5_9_0", "it_it", "set2");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set3, "5_9_0", "it_it", "set3");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set4, "5_9_0", "it_it", "set4");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set5, "5_9_0", "it_it", "set5");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set6, "5_9_0", "it_it", "set6");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set6cde, "5_9_0", "it_it", "set6cde");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set7, "5_9_0", "it_it", "set7");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set7b, "5_9_0", "it_it", "set7b");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set8, "5_9_0", "it_it", "set8");
|
||||
test_fetch!(test_fetch_5_9_0_it_it_set9, "5_9_0", "it_it", "set9");
|
||||
|
||||
test_fetch!(test_fetch_latest_en_us_set1, "latest", "en_us", "set1");
|
||||
test_fetch!(test_fetch_latest_en_us_set2, "latest", "en_us", "set2");
|
||||
|
@ -128,6 +130,7 @@ mod tests {
|
|||
test_fetch!(test_fetch_latest_en_us_set7, "latest", "en_us", "set7");
|
||||
test_fetch!(test_fetch_latest_en_us_set7b, "latest", "en_us", "set7b");
|
||||
test_fetch!(test_fetch_latest_en_us_set8, "latest", "en_us", "set8");
|
||||
test_fetch!(test_fetch_latest_en_us_set9, "latest", "en_us", "set9");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,8 @@ pub enum CardRegion {
|
|||
Evelynn,
|
||||
/// Runeterra: Bard.
|
||||
Bard,
|
||||
|
||||
/// Runeterra: Elder Dragon.
|
||||
ElderDragon,
|
||||
|
||||
/// Unsupported region.
|
||||
#[serde(other)]
|
||||
|
@ -160,6 +161,7 @@ impl CardRegion {
|
|||
CardRegion::PoroKing => "",
|
||||
CardRegion::Evelynn => "",
|
||||
CardRegion::Bard => "",
|
||||
CardRegion::ElderDragon => "",
|
||||
CardRegion::Unsupported => "<:invaliddeck:1056022952396730438>",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,14 @@ pub enum CardSet {
|
|||
/// Heart of the Huntress.
|
||||
#[serde(rename = "Set7b")]
|
||||
HeartOfTheHuntress,
|
||||
|
||||
|
||||
/// Fate's Voyage.
|
||||
#[serde(rename = "Set8")]
|
||||
FatesVoyage,
|
||||
|
||||
/// Dreamlit Paths.
|
||||
#[serde(rename = "Set9")]
|
||||
DreamlitPaths,
|
||||
|
||||
/// Events, cards released "outside" a set.
|
||||
#[serde(rename = "SetEvent")]
|
||||
|
@ -116,7 +120,8 @@ impl CardSet {
|
|||
CardSet::GloryInNavori => "<:glory_in_navori:1095363395890458756>",
|
||||
CardSet::HeartOfTheHuntress => "<:heart_of_the_huntress:1165769749922320494>",
|
||||
CardSet::FatesVoyage => "<:fates_voyage:1165769932995317851>",
|
||||
CardSet::Events => "",
|
||||
CardSet::DreamlitPaths => "", // TODO
|
||||
CardSet::Events => "", // TODO
|
||||
CardSet::Unsupported => "<:invaliddeck:1056022952396730438>",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
//!
|
||||
//! - [Usage of the Telegram bot](../patched_porobot_telegram/index.html)
|
||||
//! - [Usage of the Discord bot](../patched_porobot_discord/index.html)
|
||||
//! - ~~[Usage of the Matrix bot](../patched_porobot_matrix/index.html)~~
|
||||
//!
|
||||
//! # Features
|
||||
//!
|
||||
|
@ -22,7 +21,6 @@
|
|||
//!
|
||||
//! - [`telegram`] enables the compilation of `patched_porobot_telegram`, a [Telegram inline bot](https://core.telegram.org/bots/api) allowing users to search and send cards in any Telegram chat;
|
||||
//! - [`discord`] enables the compilation of `patched_porobot_discord`, a [Discord bot](https://discord.com/developers/docs/intro#bots-and-apps) allowing Discord servers the bot is added to to search and send cards in their channels;
|
||||
//! - ~~[`matrix`] enables the compilation of `patched_porobot_matrix`, a Matrix bot parsing messages in the rooms where it is added to to send details about the cards mentioned in messages~~.
|
||||
//!
|
||||
//! # Legal
|
||||
//!
|
||||
|
@ -41,6 +39,3 @@ pub mod telegram;
|
|||
|
||||
#[cfg(feature = "discord")]
|
||||
pub mod discord;
|
||||
|
||||
#[cfg(feature = "matrix")]
|
||||
pub mod matrix;
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
//! Module providing utilities to be used in the `patched_porobot_matrix` executable target.
|
||||
//!
|
||||
//! While adding new features to this module, remember that binaries [can only access the public API of the crate](https://doc.rust-lang.org/cargo/reference/cargo-targets.html#binaries), as they considered a separate crate from the rest of the project.
|
Loading…
Reference in a new issue