From 01d9d027c6a778ed6ebef06005ab11373b32e725 Mon Sep 17 00:00:00 2001 From: projectmoon Date: Wed, 5 Apr 2023 07:16:05 +0200 Subject: [PATCH 1/2] Rust 1.68 --- .drone.yml | 2 +- dicebot/Cargo.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 480a4d4..03f3492 100644 --- a/.drone.yml +++ b/.drone.yml @@ -3,7 +3,7 @@ name: build-and-test steps: - name: test - image: rust:1.54 + image: rust:1.68 commands: - apt-get update - apt-get install -y cmake diff --git a/dicebot/Cargo.toml b/dicebot/Cargo.toml index 521b10e..c3cc641 100644 --- a/dicebot/Cargo.toml +++ b/dicebot/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "tenebrous-dicebot" version = "0.13.1" +rust-version = "1.68" authors = ["projectmoon ", "Taylor C. Richberger "] edition = "2018" license = 'AGPL-3.0-or-later' -- 2.40.1 From 6d6f2ffea3867295f07d5675c65284f29555d349 Mon Sep 17 00:00:00 2001 From: projectmoon Date: Mon, 3 Apr 2023 22:01:17 +0200 Subject: [PATCH 2/2] Add help topic for variables Fixes #60 --- Cargo.lock | 2 +- dicebot/Cargo.toml | 2 +- dicebot/src/help.rs | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b3e9f16..c5d7039 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2944,7 +2944,7 @@ dependencies = [ [[package]] name = "tenebrous-dicebot" -version = "0.13.1" +version = "0.13.2" dependencies = [ "async-trait", "barrel", diff --git a/dicebot/Cargo.toml b/dicebot/Cargo.toml index c3cc641..3f8bdee 100644 --- a/dicebot/Cargo.toml +++ b/dicebot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tenebrous-dicebot" -version = "0.13.1" +version = "0.13.2" rust-version = "1.68" authors = ["projectmoon ", "Taylor C. Richberger "] edition = "2018" diff --git a/dicebot/src/help.rs b/dicebot/src/help.rs index 7eeebf5..9f131ac 100644 --- a/dicebot/src/help.rs +++ b/dicebot/src/help.rs @@ -6,6 +6,9 @@ pub fn parse_help_topic(input: &str) -> Option { "dicepool" => Some(HelpTopic::DicePool), "dice" => Some(HelpTopic::RollingDice), "cthulhu" => Some(HelpTopic::Cthulhu), + "variables" => Some(HelpTopic::Variables), + "var" => Some(HelpTopic::Variables), + "variable" => Some(HelpTopic::Variables), "" => Some(HelpTopic::General), _ => None, } @@ -16,6 +19,7 @@ pub enum HelpTopic { DicePool, Cthulhu, RollingDice, + Variables, General, } @@ -101,6 +105,34 @@ Note: If !cthadv is given a variable, and the roll is successful, it will update the variable with the new skill. "}; +const VARIABLES_HELP: &'static str = indoc! {" +Variables + +Commands: !get, !set, !variables + +Manage variables that can be substituted into roll commands. + +Examples: !get myvar, !set myvar 10 + +!get = show variable of the given name +!set = set a variable to a number + +The !variables command will list all variables for the room. The +variables command cna be used in a secure room to avoid spamming the +actual room that the variable is set in. + +Variable names can be used in all types of dice rolls: + +!pool myvar + 3 +!roll myvar + +There are some limitations on variables: they cannot themselves be +dice expressions (i.e. can only be numbers), and they must be uniquely +parseable in an expression (i.e 'myvard6' does not work for the !roll +command). + +"}; + const GENERAL_HELP: &'static str = indoc! {" General Help @@ -117,6 +149,7 @@ impl HelpTopic { HelpTopic::DicePool => DICEPOOL_HELP, HelpTopic::Cthulhu => CTHULHU_HELP, HelpTopic::RollingDice => DICE_HELP, + HelpTopic::Variables => VARIABLES_HELP, HelpTopic::General => GENERAL_HELP, } } -- 2.40.1