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
|
|
@ -1,3 +1,5 @@
|
|||
#[macro_use] extern crate rocket;
|
||||
|
||||
use std::{sync::{Arc, Mutex}};
|
||||
|
||||
use clap::Parser;
|
||||
|
|
@ -5,8 +7,9 @@ use dotenvy::dotenv;
|
|||
use poise::serenity_prelude as serenity;
|
||||
use squad_quest::config::Config;
|
||||
|
||||
use crate::{commands::error_handler, config::{ConfigImpl, DiscordConfig}, error::Error, strings::Strings};
|
||||
use crate::{commands::{error_handler, print_error_recursively}, config::{ConfigImpl, DiscordConfig}, error::Error, strings::Strings};
|
||||
|
||||
mod api;
|
||||
mod commands;
|
||||
mod cli;
|
||||
mod config;
|
||||
|
|
@ -65,6 +68,14 @@ async fn main() {
|
|||
let token = std::env::var(DISCORD_TOKEN).expect("missing DISCORD_TOKEN");
|
||||
let intents = serenity::GatewayIntents::non_privileged();
|
||||
|
||||
let conf1 = config.clone();
|
||||
tokio::spawn(async {
|
||||
if let Err(error) = api::rocket(conf1).launch().await {
|
||||
eprintln!("ERROR ON API LAUNCH");
|
||||
print_error_recursively(&error);
|
||||
}
|
||||
});
|
||||
|
||||
let framework = poise::Framework::builder()
|
||||
.options(poise::FrameworkOptions {
|
||||
on_error: |err| Box::pin(error_handler(err)),
|
||||
|
|
@ -87,6 +98,8 @@ async fn main() {
|
|||
.setup(|_ctx, _ready, _framework| {
|
||||
Box::pin(async move {
|
||||
//poise::builtins::register_globally(ctx, &framework.options().commands).await?;
|
||||
|
||||
|
||||
Ok(Data {
|
||||
config,
|
||||
discord: Arc::new(Mutex::new(discord)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue