feat: removed the cronjob for updating the committee server

This commit is contained in:
silver 2025-07-20 22:33:56 +01:00
parent 96eb81293b
commit eb88216740
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D
3 changed files with 0 additions and 68 deletions

View file

@ -8,9 +8,6 @@ edition = "2021"
[[bin]]
name = "update_data"
[[bin]]
name = "update_committee"
[[bin]]
name = "update_minecraft"

View file

@ -154,8 +154,6 @@
scripts = {
# every 20 min
"update_data" = "*:0,10,20,30,40,50";
# Committee server has its own timer
"update_committee" = "*:15:00";
# minecraft stuff is updated at 5am
"update_minecraft" = "5:10:00";
# server icon gets updated daily at midnight

View file

@ -1,63 +0,0 @@
use serenity::all::{ChunkGuildFilter, GuildId};
use serenity::{
async_trait,
client::{Context, EventHandler},
model::gateway::{GatewayIntents, Ready},
Client,
};
use skynet_discord_bot::common::database::{db_init, DataBase};
use skynet_discord_bot::common::set_roles::committee;
use skynet_discord_bot::{get_config, Config};
use std::{process, sync::Arc};
use tokio::sync::RwLock;
#[tokio::main]
async fn main() {
let config = get_config();
let db = match db_init(&config).await {
Ok(x) => x,
Err(_) => return,
};
// Intents are a bitflag, bitwise operations can be used to dictate which intents to use
let intents = GatewayIntents::GUILDS | GatewayIntents::GUILD_MESSAGES | GatewayIntents::MESSAGE_CONTENT | GatewayIntents::GUILD_MEMBERS;
// Build our client.
let mut client = Client::builder(&config.discord_token, intents)
.event_handler(Handler {})
.cache_settings(serenity::cache::Settings::default())
.await
.expect("Error creating client");
{
let mut data = client.data.write().await;
data.insert::<Config>(Arc::new(RwLock::new(config)));
data.insert::<DataBase>(Arc::new(RwLock::new(db)));
}
if let Err(why) = client.start().await {
println!("Client error: {:?}", why);
}
}
struct Handler;
#[async_trait]
impl EventHandler for Handler {
async fn cache_ready(&self, ctx: Context, guilds: Vec<GuildId>) {
for guild in guilds {
ctx.shard.chunk_guild(guild, Some(2000), false, ChunkGuildFilter::None, None);
}
println!("Cache built successfully!");
}
async fn ready(&self, ctx: Context, ready: Ready) {
let ctx = Arc::new(ctx);
println!("{} is connected!", ready.user.name);
// u[date committee server
committee::check_committee(Arc::clone(&ctx)).await;
// finish up
process::exit(0);
}
}