From e7d43adc40551a8f6e5a92b643886daf61afbc80 Mon Sep 17 00:00:00 2001 From: Akulij Date: Sun, 18 May 2025 16:10:03 +0300 Subject: [PATCH] create structs for bot's configuration definition --- src/botscript.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/botscript.rs b/src/botscript.rs index 966565c..3868b91 100644 --- a/src/botscript.rs +++ b/src/botscript.rs @@ -1,7 +1,11 @@ +use std::collections::HashMap; + use quickjs_rusty::Context; use quickjs_rusty::ContextError; use quickjs_rusty::ExecutionError; use quickjs_rusty::OwnedJsValue as JsValue; +use serde::Deserialize; +use serde::Serialize; #[derive(thiserror::Error, Debug)] pub enum ScriptError { @@ -13,12 +17,39 @@ pub enum ScriptError { pub type ScriptResult = Result; +pub type BotFunction = String; // temporal workaround + // TODO: remove this function since it is suitable only for early development #[allow(clippy::print_stdout)] fn print(s: String) { println!("{s}"); } +#[derive(Serialize, Deserialize, Debug)] +pub struct BotConfig { + version: f64, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct Button { + name: String, +} + +#[derive(Serialize, Deserialize, Debug)] +pub struct BotMessage { + // buttons: Vec