feat: Added API for web map in discord bot
- Bump version to 0.11.0 - Added data table to quests, accounts and rooms - Discord bot now adds "avatar" and "name" data to accounts on init - Added CLI "map data" command
This commit is contained in:
parent
0ab777d898
commit
c22787792d
18 changed files with 1161 additions and 224 deletions
|
|
@ -9,5 +9,5 @@ license.workspace = true
|
|||
chrono = "0.4.42"
|
||||
clap = { version = "4.5.53", features = ["derive"] }
|
||||
serde = { version = "1.0.228", features = ["derive"] }
|
||||
squad-quest = { version = "0.10.0", path = ".." }
|
||||
squad-quest = { version = "0.11.0", path = ".." }
|
||||
toml = "0.9.8"
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ pub enum MapCommands {
|
|||
Delete(MapDeleteArgs),
|
||||
/// Update room data
|
||||
Update(MapUpdateArgs),
|
||||
/// Get room implementation data
|
||||
Data(MapDataArgs),
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
|
|
@ -55,3 +57,9 @@ pub struct MapUpdateArgs {
|
|||
#[arg(short,long)]
|
||||
pub value: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct MapDataArgs {
|
||||
/// Room ID
|
||||
pub id: u16,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,8 @@ fn main() {
|
|||
answer: args.answer.clone(),
|
||||
public: args.public,
|
||||
available_on: args.available.clone(),
|
||||
deadline: args.deadline.clone()
|
||||
deadline: args.deadline.clone(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
do_and_log(quest.save(path), !cli.quiet, format!("Created quest #{}.", quest.id));
|
||||
|
|
@ -169,7 +170,8 @@ fn main() {
|
|||
answer: args.answer.clone().unwrap_or(quest.answer.clone()),
|
||||
public: args.public.unwrap_or(quest.public),
|
||||
available_on: args.available.clone().or(quest.available_on.clone()),
|
||||
deadline: args.deadline.clone().or(quest.deadline.clone())
|
||||
deadline: args.deadline.clone().or(quest.deadline.clone()),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
do_and_log(quest.save(path), !cli.quiet, format!("Updated quest #{}.", quest.id));
|
||||
|
|
@ -445,6 +447,15 @@ fn main() {
|
|||
let connected = if connect { "Connected" } else { "Disconnected" };
|
||||
do_and_log(map_save(map, map_path), !cli.quiet, format!("{connected} rooms #{} <-> #{}.", args.first, args.second));
|
||||
},
|
||||
MapCommands::Data(args) => {
|
||||
if let Some(room) = map.room.iter().find(|r| r.id == args.id) {
|
||||
if let Some(data) = &room.data {
|
||||
for (key, value) in data {
|
||||
println!("{key} = {value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue