Skip to content
Commits on Source (14)
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: daily
- package-ecosystem: docker
directory: /
schedule:
interval: daily
## [1.1.5](https://gitlab.pentacore.se/penta/ropeplay/compare/v1.1.4...v1.1.5) (2023-01-04)
### Bug Fixes
* **level:** Add new level feedback ([ecd6c3d](https://gitlab.pentacore.se/penta/ropeplay/commit/ecd6c3d0e30fdbb63049abe9915dc3df485144ae))
* **xp:** Fix level up notice not existing ([03a368c](https://gitlab.pentacore.se/penta/ropeplay/commit/03a368c7e8551eb783b1be0edf683b06d2275f22))
## [1.1.4](https://gitlab.pentacore.se/penta/ropeplay/compare/v1.1.3...v1.1.4) (2022-11-09)
......
......@@ -26,24 +26,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "android_system_properties"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"
dependencies = [
"libc",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "async-trait"
version = "0.1.57"
......@@ -143,18 +125,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfd4d1b31faaa3a89d7934dbded3111da0d2ef28e3ebccdb4f0179f5929d1ef1"
dependencies = [
"iana-time-zone",
"num-integer",
"num-traits",
"winapi",
]
[[package]]
name = "command_attr"
version = "0.4.1"
......@@ -542,20 +512,6 @@ dependencies = [
"tokio-native-tls",
]
[[package]]
name = "iana-time-zone"
version = "0.1.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c495f162af0bf17656d0014a0eded5f3cd2f365fdd204548c2869db89359dc7"
dependencies = [
"android_system_properties",
"core-foundation-sys",
"js-sys",
"once_cell",
"wasm-bindgen",
"winapi",
]
[[package]]
name = "idna"
version = "0.2.3"
......@@ -650,15 +606,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4"
[[package]]
name = "matchers"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1"
dependencies = [
"regex-automata",
]
[[package]]
name = "matches"
version = "0.1.9"
......@@ -727,13 +674,13 @@ dependencies = [
]
[[package]]
name = "num-integer"
version = "0.1.45"
name = "nu-ansi-term"
version = "0.46.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
dependencies = [
"autocfg",
"num-traits",
"overload",
"winapi",
]
[[package]]
......@@ -833,6 +780,12 @@ dependencies = [
"num-traits",
]
[[package]]
name = "overload"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
name = "parking_lot"
version = "0.12.1"
......@@ -945,24 +898,15 @@ dependencies = [
[[package]]
name = "regex"
version = "1.6.0"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.6.27"
......@@ -1039,7 +983,7 @@ dependencies = [
[[package]]
name = "rope_play"
version = "1.0.3"
version = "1.1.4"
dependencies = [
"dotenv",
"rand",
......@@ -1491,9 +1435,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
[[package]]
name = "tokio"
version = "1.20.1"
version = "1.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581"
checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3"
dependencies = [
"autocfg",
"bytes",
......@@ -1501,7 +1445,6 @@ dependencies = [
"memchr",
"mio",
"num_cpus",
"once_cell",
"pin-project-lite",
"signal-hook-registry",
"socket2",
......@@ -1587,9 +1530,9 @@ dependencies = [
[[package]]
name = "tracing-core"
version = "0.1.29"
version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7"
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
dependencies = [
"once_cell",
"valuable",
......@@ -1606,36 +1549,18 @@ dependencies = [
"tracing-core",
]
[[package]]
name = "tracing-serde"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1"
dependencies = [
"serde",
"tracing-core",
]
[[package]]
name = "tracing-subscriber"
version = "0.2.25"
version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71"
checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
dependencies = [
"ansi_term",
"chrono",
"lazy_static",
"matchers",
"regex",
"serde",
"serde_json",
"nu-ansi-term",
"sharded-slab",
"smallvec",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
"tracing-serde",
]
[[package]]
......
[package]
name = "rope_play"
version = "1.1.4"
version = "1.1.5"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
......@@ -8,7 +8,7 @@ edition = "2021"
[dependencies]
dotenv = "0.15"
tracing = "0.1.23"
tracing-subscriber = "0.2"
tracing-subscriber = "0.3"
regex = "1"
rand = "0.8.5"
strum = "0.24.1"
......@@ -16,7 +16,7 @@ strum_macros = "0.24"
sentry = "0.27.0"
[dependencies.tokio]
version = "1.20"
version = "1.22"
features = ["macros", "signal", "rt-multi-thread"]
[dependencies.serenity]
......
......@@ -158,7 +158,7 @@ async fn execute_up(
let levels = get_levels_option("levels", subcommand);
dashboard.level += levels as usize;
return match dashboard.update(ctx).await {
Ok(_) => Ok(format!("The level has been increased by {}", levels.to_string())),
Ok(_) => Ok(format!("The level has been increased by {}, now level {}", levels.to_string(), dashboard.level)),
Err(err) => Err(err),
};
}
......@@ -171,7 +171,7 @@ async fn execute_down(
let levels = get_levels_option("levels", subcommand);
dashboard.level -= levels as usize;
return match dashboard.update(ctx).await {
Ok(_) => Ok(format!("The level has been decreased by {}", levels.to_string())),
Ok(_) => Ok(format!("The level has been decreased by {}, now level {}", levels.to_string(), dashboard.level)),
Err(err) => Err(err),
};
}
......
......@@ -137,9 +137,10 @@ async fn execute_add(
) -> RopePlayResult<String> {
let xp = get_xp_option("amount", subcommand);
dashboard.xp += xp.clone();
let old_level = dashboard.level.clone();
dashboard.level = dashboard.leveling_speed.get_level_from_xp(dashboard.xp) as usize;
return match dashboard.update(ctx).await {
Ok(_) => Ok(format!("Added {} xp, new total {}", xp.to_string(), dashboard.xp)),
Ok(_) => Ok(format!("Added {} xp, new total {}{}", xp.to_string(), dashboard.xp, level_up_text(old_level, dashboard.level))),
Err(err) => Err(err),
};
}
......@@ -151,9 +152,10 @@ async fn execute_remove(
) -> RopePlayResult<String> {
let xp = get_xp_option("amount", subcommand);
dashboard.xp -= xp.clone();
let old_level = dashboard.level.clone();
dashboard.level = dashboard.leveling_speed.get_level_from_xp(dashboard.xp) as usize;
return match dashboard.update(ctx).await {
Ok(_) => Ok(format!("Removed {} xp, new total {}", xp.to_string(), dashboard.xp)),
Ok(_) => Ok(format!("Removed {} xp, new total {}{}", xp.to_string(), dashboard.xp, level_up_text(old_level, dashboard.level))),
Err(err) => Err(err),
};
}
......@@ -165,13 +167,22 @@ async fn execute_set(
) -> RopePlayResult<String> {
let xp = get_xp_option("amount", subcommand);
dashboard.xp = xp.clone();
let old_level = dashboard.level.clone();
dashboard.level = dashboard.leveling_speed.get_level_from_xp(dashboard.xp) as usize;
return match dashboard.update(ctx).await {
Ok(_) => Ok(format!("The xp has been set to {}", xp.to_string())),
Ok(_) => Ok(format!("The xp has been set to {}{}", xp.to_string(), level_up_text(old_level, dashboard.level))),
Err(err) => Err(err),
};
}
fn level_up_text(old_level: usize, current_level: usize) -> String {
if old_level < current_level {
return format!("\nDING DING! You have leveled up! You are now level {}!", current_level);
}
return "".to_string();
}
fn get_xp_option(name: &str, subcommand: &CommandDataOption) -> i32 {
return match find_subcommand_option_by_name(subcommand, name) {
Ok(cdo) => {
......