Fixed issue with listener add role actions treating seconds as hours
This commit is contained in:
parent
df1900a7f8
commit
3ec319b93d
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -1093,7 +1093,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fren"
|
||||
version = "2.1.0"
|
||||
version = "2.1.1"
|
||||
dependencies = [
|
||||
"axum 0.8.1",
|
||||
"base64 0.22.1",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "fren"
|
||||
version = "2.1.0"
|
||||
version = "2.1.1"
|
||||
edition = "2024"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
@ -59,6 +59,10 @@ impl BotConfig {
|
||||
|
||||
cfg.try_deserialize()
|
||||
}
|
||||
|
||||
pub fn effect_role_duration(&self) -> chrono::Duration {
|
||||
chrono::Duration::seconds(self.effect_role_duration)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@ -175,7 +175,7 @@ pub async fn land_mine(
|
||||
channel_id: Some(channel.id()),
|
||||
content: None,
|
||||
},
|
||||
vec![Action::Kill { hours: ctx.data().cfg.effect_role_duration as u16}, Action::Speak {msg: "*click* **BOOM**, sorry kid you've run out of time. That was a landmine. You're dead.".to_string()}],
|
||||
vec![Action::Kill { hours: ctx.data().cfg.effect_role_duration().num_hours() }, Action::Speak {msg: "*click* **BOOM**, sorry kid you've run out of time. That was a landmine. You're dead.".to_string()}],
|
||||
0.95,
|
||||
Expiration::NumberOfTriggers { triggers: 1 },
|
||||
false
|
||||
@ -211,7 +211,7 @@ pub async fn phrase_canceler(
|
||||
channel_id: None,
|
||||
content: Some(phrase),
|
||||
},
|
||||
vec![Action::Cancel { hours: ctx.data().cfg.effect_role_duration as u16}, Action::Speak {msg: "oof, dude. Don't you know the Christopher Columbus connotations of what you just said? Consider yourself canceled.".to_string()}],
|
||||
vec![Action::Cancel { hours: ctx.data().cfg.effect_role_duration().num_hours() }, Action::Speak {msg: "oof, dude. Don't you know the Christopher Columbus connotations of what you just said? Consider yourself canceled.".to_string()}],
|
||||
1.0,
|
||||
Expiration::NumberOfTriggers { triggers: 1 },
|
||||
false
|
||||
@ -241,7 +241,7 @@ pub async fn nuke(ctx: Context<'_>) -> Result<(), Error> {
|
||||
content: None,
|
||||
},
|
||||
vec![
|
||||
Action::Ghoulify { hours: ctx.data().cfg.effect_role_duration as u16 },
|
||||
Action::Ghoulify { hours: ctx.data().cfg.effect_role_duration().num_hours() },
|
||||
Action::Speak { msg: "As the radiation exposure sets in, you notice changes. Your flesh begins to deteriorate. Your voice becomes raspy. You are now a ghoul. https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExdjJpcmtwbXRhZml1djd3ZGI3bjhhb3dxYm1vdmVpN2swN2hiZnNzZiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/83uF5ITtkxbUul6gMB/giphy.gif".to_string()}
|
||||
],
|
||||
0.5,
|
||||
|
||||
@ -91,13 +91,13 @@ impl TriggerEvent {
|
||||
#[serde(tag = "type")]
|
||||
pub enum Action {
|
||||
Kill {
|
||||
hours: u16,
|
||||
hours: i64,
|
||||
},
|
||||
Cancel {
|
||||
hours: u16,
|
||||
hours: i64,
|
||||
},
|
||||
Ghoulify {
|
||||
hours: u16,
|
||||
hours: i64,
|
||||
},
|
||||
UpdateSocialCredit {
|
||||
score_diff: i64,
|
||||
@ -194,7 +194,7 @@ impl Listener {
|
||||
trigger_event.triggerer,
|
||||
data.cfg.guild_id,
|
||||
UserRole::Dead,
|
||||
Duration::hours(*hours as i64),
|
||||
Duration::hours(*hours),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
@ -205,7 +205,7 @@ impl Listener {
|
||||
trigger_event.triggerer,
|
||||
data.cfg.guild_id,
|
||||
UserRole::Cancelled,
|
||||
Duration::hours(*hours as i64),
|
||||
Duration::hours(*hours),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
@ -249,7 +249,7 @@ impl Listener {
|
||||
trigger_event.triggerer,
|
||||
data.cfg.guild_id,
|
||||
UserRole::Ghoul,
|
||||
Duration::hours(*hours as i64),
|
||||
Duration::hours(*hours),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user