* init * bot framework done * here and ready for orm * might use sea-orm * orm done * use teloxide * ready to go? * 需要完成命令部分 * 需要完成:list_handler() * 查询用户名应当以@开头 * use rustls to avoid segfault? * postgresql ready * inline query done * list_handler * flattern code * test needed * ready to build * some bugs * almost done * ready to take off Co-authored-by: senset <dummy@dummy.d>
37 lines
690 B
Rust
37 lines
690 B
Rust
mod callback_commands;
|
|
mod commands;
|
|
mod config;
|
|
mod db_controller;
|
|
mod messages;
|
|
mod telegram_bot;
|
|
|
|
use clap::Parser;
|
|
use config::Args;
|
|
use telegram_bot::BotServer;
|
|
use wd_log::{log_debug_ln, log_panic, set_level, set_prefix, DEBUG, INFO};
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
let args = Args::parse();
|
|
|
|
set_prefix("saysthbot");
|
|
|
|
if args.debug {
|
|
set_level(DEBUG);
|
|
log_debug_ln!("{:?}", args);
|
|
} else {
|
|
set_level(INFO);
|
|
}
|
|
|
|
let bot = match BotServer::new(args).await {
|
|
Ok(bot) => bot,
|
|
Err(err) => log_panic!("{}", err),
|
|
};
|
|
|
|
if let Err(err) = bot.init().await {
|
|
log_panic!("{}", err);
|
|
}
|
|
|
|
bot.run().await;
|
|
}
|