cache
This commit is contained in:
parent
e934da887f
commit
11f6f1edbf
4 changed files with 26 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ use secrecy::ExposeSecret;
|
|||
use serenity::{
|
||||
Client,
|
||||
all::{GatewayIntents, Token},
|
||||
cache,
|
||||
};
|
||||
use sqlx::{migrate, postgres::PgPoolOptions};
|
||||
use tracing::Level;
|
||||
|
|
@ -53,18 +54,21 @@ async fn main() -> anyhow::Result<()> {
|
|||
|
||||
info!("migrated database");
|
||||
|
||||
let mut cache_settings = cache::Settings::default();
|
||||
cache_settings.max_messages = 100;
|
||||
|
||||
let mut client = Client::builder(
|
||||
Token::from_str(config.bot.token.expose_secret()).unwrap(),
|
||||
GatewayIntents::GUILD_MESSAGES
|
||||
| GatewayIntents::GUILD_MESSAGE_REACTIONS
|
||||
| GatewayIntents::GUILDS
|
||||
| GatewayIntents::GUILD_MESSAGES
|
||||
| GatewayIntents::MESSAGE_CONTENT,
|
||||
)
|
||||
.event_handler(Arc::new(Handler {
|
||||
db,
|
||||
message_lock: Arc::new(DashMap::new()),
|
||||
}))
|
||||
.cache_settings(cache_settings)
|
||||
.await
|
||||
.expect("Err creating client");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue