feat: send category
This commit is contained in:
parent
18eba1d443
commit
e739c443ac
7 changed files with 53 additions and 13 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use std::{str::FromStr, sync::Arc};
|
||||
|
||||
use crate::{config::Config, handler::Handler};
|
||||
use anyhow::Context;
|
||||
use dashmap::DashMap;
|
||||
use figment::{
|
||||
|
|
@ -12,8 +13,7 @@ use serenity::{
|
|||
all::{GatewayIntents, Token},
|
||||
};
|
||||
use sqlx::{migrate, postgres::PgPoolOptions};
|
||||
|
||||
use crate::{config::Config, handler::Handler};
|
||||
use tracing::Level;
|
||||
|
||||
mod commands;
|
||||
mod config;
|
||||
|
|
@ -26,7 +26,7 @@ extern crate tracing;
|
|||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
tracing_subscriber::fmt::init();
|
||||
let mut fmt = tracing_subscriber::fmt();
|
||||
|
||||
let figment = Figment::new()
|
||||
.merge(Toml::file("config.toml"))
|
||||
|
|
@ -34,6 +34,12 @@ async fn main() -> anyhow::Result<()> {
|
|||
|
||||
let config: Config = figment.extract()?;
|
||||
|
||||
if config.debug.unwrap_or(false) {
|
||||
fmt = fmt.with_max_level(Level::DEBUG);
|
||||
}
|
||||
|
||||
fmt.init();
|
||||
|
||||
info!("config: {config:?}");
|
||||
|
||||
let db = PgPoolOptions::new()
|
||||
|
|
@ -49,7 +55,9 @@ async fn main() -> anyhow::Result<()> {
|
|||
|
||||
let mut client = Client::builder(
|
||||
Token::from_str(config.bot.token.expose_secret()).unwrap(),
|
||||
GatewayIntents::GUILD_MESSAGES | GatewayIntents::GUILD_MESSAGE_REACTIONS,
|
||||
GatewayIntents::GUILD_MESSAGES
|
||||
| GatewayIntents::GUILD_MESSAGE_REACTIONS
|
||||
| GatewayIntents::GUILDS,
|
||||
)
|
||||
.event_handler(Arc::new(Handler {
|
||||
db,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue