about summary refs log tree commit diff
path: root/src/command/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/mod.rs')
-rw-r--r--src/command/mod.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/command/mod.rs b/src/command/mod.rs
index 165cdb6..73b292a 100644
--- a/src/command/mod.rs
+++ b/src/command/mod.rs
@@ -1,8 +1,10 @@
 mod add_points;
 mod leaderboard;
+mod revise;
 
 pub use add_points::add_points;
 pub use leaderboard::leaderboard;
+pub use revise::revise;
 
 use std::sync::Arc;
 
@@ -27,6 +29,7 @@ pub enum Commands {
 	About,
 	Leaderboard,
 	Points,
+	Revise,
 	Permission,
 	Import,
 }
@@ -43,6 +46,7 @@ pub async fn handler(
 		Commands::About => about(brain.clone(), guild),
 		Commands::Leaderboard => leaderboard(brain.clone(), guild, Some(command_data)),
 		Commands::Points => add_points(brain.clone(), guild, create, command_data).await,
+		Commands::Revise => revise(brain.clone(), guild, create, command_data).await,
 		Commands::Permission => permission(brain.clone(), guild, create, command_data).await,
 		Commands::Import => {
 			import(brain.clone(), guild, create, command_data).await;
@@ -82,6 +86,24 @@ pub async fn build() -> Vec<Command> {
 		.unwrap()
 		.build();
 
+	let revise = CommandBuilder::new(
+		"revise",
+		"Change history by adding/removing points at a specific point in time",
+		CommandType::ChatInput,
+	)
+	.option(IntegerBuilder::new("points", "number of points. - or +").required(true))
+	.option(StringBuilder::new("users", "mention people to modify their points!!").required(true))
+	.option(
+		StringBuilder::new(
+			"date",
+			"Date string in the YYYY-DD-MM format, with optional time component (HH:MM:SS, 24-hour time)",
+		)
+		.required(true),
+	)
+	.validate()
+	.unwrap()
+	.build();
+
 	let permission = CommandBuilder::new(
 		"permission",
 		"set who is allowed to change points",
@@ -104,7 +126,7 @@ pub async fn build() -> Vec<Command> {
 	)
 	.build();
 
-	vec![about, leaderboard, points, permission, import]
+	vec![about, leaderboard, points, revise, permission, import]
 }
 
 pub fn about(_brain: Arc<Brain>, _guild: Id<GuildMarker>) -> InteractionResponseData {