mirror of
https://github.com/Steffo99/patched-porobot.git
synced 2024-12-22 17:44:22 +00:00
Compare commits
1 commit
abc6b7011f
...
4bdb01eb61
Author | SHA1 | Date | |
---|---|---|---|
4bdb01eb61 |
15 changed files with 667 additions and 743 deletions
|
@ -1 +0,0 @@
|
|||
Patched Porobot
|
|
@ -1,8 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PWA">
|
||||
<option name="wasEnabledAtLeastOnce" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_22">
|
||||
<component name="ProjectRootManager">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
1264
Cargo.lock
generated
1264
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "patched_porobot"
|
||||
version = "1.0.1"
|
||||
version = "0.15.0"
|
||||
authors = ["Stefano Pigozzi <me@steffo.eu>"]
|
||||
edition = "2021"
|
||||
description = "Legends of Runeterra card database utilities and bots"
|
||||
|
@ -46,6 +46,7 @@ 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]
|
||||
|
@ -59,6 +60,7 @@ exec = ["pretty_env_logger"]
|
|||
search = ["tantivy"]
|
||||
telegram = ["exec", "search", "jpg", "teloxide", "tokio", "md5", "rand"]
|
||||
discord = ["exec", "search", "serenity", "tokio", "anyhow"]
|
||||
matrix = ["exec", "search"]
|
||||
|
||||
|
||||
[lib]
|
||||
|
@ -71,3 +73,7 @@ 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.81-bookworm AS builder
|
||||
FROM --platform=${BUILDPLATFORM} rust:1.68-bullseye AS builder
|
||||
ARG BUILDPLATFORM
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
|
@ -60,7 +60,7 @@ RUN \
|
|||
|
||||
#############################################################################
|
||||
|
||||
FROM --platform=${TARGETPLATFORM} rust:1.81-slim-bookworm AS final
|
||||
FROM --platform=${TARGETPLATFORM} rust:1.68-slim-bullseye AS final
|
||||
|
||||
WORKDIR /usr/src/patched_porobot/
|
||||
COPY --from=builder \
|
||||
|
|
|
@ -13,6 +13,10 @@ 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)
|
||||
|
||||
|
|
7
src/bin/patched_porobot_matrix.rs
Normal file
7
src/bin/patched_porobot_matrix.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
//! 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_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_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_latest_en_us, "latest", "en_us");
|
||||
|
||||
macro_rules! test_supported {
|
||||
|
@ -140,7 +140,7 @@ mod tests {
|
|||
};
|
||||
}
|
||||
|
||||
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_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_latest_en_us, "latest", "en_us");
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ 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,11 +220,10 @@ pub enum CardKeyword {
|
|||
Fated,
|
||||
|
||||
#[serde(alias = "BlocksElusive")]
|
||||
#[serde(alias = "BlockElusive")]
|
||||
/// Sharpsight.
|
||||
/// ???
|
||||
///
|
||||
/// > Can block Elusive units.
|
||||
Sharpsight,
|
||||
BlockElusive,
|
||||
|
||||
/// Fury.
|
||||
///
|
||||
|
@ -332,11 +331,6 @@ 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,
|
||||
|
@ -377,23 +371,6 @@ 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)]
|
||||
|
@ -487,18 +464,12 @@ impl CardKeyword {
|
|||
CardKeyword::Nightfall => "",
|
||||
CardKeyword::Daybreak => "",
|
||||
CardKeyword::Plunder => "",
|
||||
CardKeyword::Sharpsight => "",
|
||||
CardKeyword::BlockElusive => "",
|
||||
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>",
|
||||
}
|
||||
|
@ -567,9 +538,8 @@ 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::Sharpsight);
|
||||
test_deserialization!(deserialize_blockelusive2, r#""BlocksElusive""#, CardKeyword::Sharpsight);
|
||||
test_deserialization!(deserialize_sharpsight, r#""Sharpsight""#, CardKeyword::Sharpsight);
|
||||
test_deserialization!(deserialize_blockelusive, r#""BlockElusive""#, CardKeyword::BlockElusive);
|
||||
test_deserialization!(deserialize_blockelusive2, r#""BlocksElusive""#, CardKeyword::BlockElusive);
|
||||
test_deserialization!(deserialize_fury, r#""Fury""#, CardKeyword::Fury);
|
||||
test_deserialization!(deserialize_barrier, r#""Barrier""#, CardKeyword::Barrier);
|
||||
test_deserialization!(deserialize_immobile, r#""Immobile""#, CardKeyword::Immobile);
|
||||
|
@ -600,11 +570,5 @@ 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,29 +96,27 @@ mod tests {
|
|||
};
|
||||
}
|
||||
|
||||
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_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_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_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_latest_en_us_set1, "latest", "en_us", "set1");
|
||||
test_fetch!(test_fetch_latest_en_us_set2, "latest", "en_us", "set2");
|
||||
|
@ -130,7 +128,6 @@ 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,8 +52,7 @@ pub enum CardRegion {
|
|||
Evelynn,
|
||||
/// Runeterra: Bard.
|
||||
Bard,
|
||||
/// Runeterra: Elder Dragon.
|
||||
ElderDragon,
|
||||
|
||||
|
||||
/// Unsupported region.
|
||||
#[serde(other)]
|
||||
|
@ -161,7 +160,6 @@ impl CardRegion {
|
|||
CardRegion::PoroKing => "",
|
||||
CardRegion::Evelynn => "",
|
||||
CardRegion::Bard => "",
|
||||
CardRegion::ElderDragon => "",
|
||||
CardRegion::Unsupported => "<:invaliddeck:1056022952396730438>",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,14 +43,10 @@ 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")]
|
||||
|
@ -120,8 +116,7 @@ impl CardSet {
|
|||
CardSet::GloryInNavori => "<:glory_in_navori:1095363395890458756>",
|
||||
CardSet::HeartOfTheHuntress => "<:heart_of_the_huntress:1165769749922320494>",
|
||||
CardSet::FatesVoyage => "<:fates_voyage:1165769932995317851>",
|
||||
CardSet::DreamlitPaths => "", // TODO
|
||||
CardSet::Events => "", // TODO
|
||||
CardSet::Events => "",
|
||||
CardSet::Unsupported => "<:invaliddeck:1056022952396730438>",
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
//!
|
||||
//! - [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
|
||||
//!
|
||||
|
@ -21,6 +22,7 @@
|
|||
//!
|
||||
//! - [`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
|
||||
//!
|
||||
|
@ -39,3 +41,6 @@ pub mod telegram;
|
|||
|
||||
#[cfg(feature = "discord")]
|
||||
pub mod discord;
|
||||
|
||||
#[cfg(feature = "matrix")]
|
||||
pub mod matrix;
|
||||
|
|
3
src/matrix/mod.rs
Normal file
3
src/matrix/mod.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
//! 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