fmt: clippy and nightly fmt
This commit is contained in:
parent
57d4947edf
commit
9d409e3692
20 changed files with 194 additions and 143 deletions
|
@ -7,4 +7,4 @@ fn_params_layout = "Compressed"
|
|||
struct_lit_width = 0
|
||||
tab_spaces = 2
|
||||
use_small_heuristics = "Max"
|
||||
#imports_granularity="Crate"
|
||||
imports_granularity = "Crate"
|
|
@ -1,14 +1,17 @@
|
|||
use serenity::all::{ChunkGuildFilter, GuildId, GuildMembersChunkEvent};
|
||||
use serenity::{
|
||||
all::{ChunkGuildFilter, GuildId, GuildMembersChunkEvent},
|
||||
async_trait,
|
||||
client::{Context, EventHandler},
|
||||
model::gateway::{GatewayIntents, Ready},
|
||||
model::gateway::GatewayIntents,
|
||||
Client,
|
||||
};
|
||||
use skynet_discord_bot::common::database::{db_init, DataBase};
|
||||
|
||||
use skynet_discord_bot::common::set_roles::committee::db_roles_get;
|
||||
use skynet_discord_bot::{get_config, Config};
|
||||
use skynet_discord_bot::{
|
||||
common::{
|
||||
database::{db_init, DataBase},
|
||||
set_roles::committee::db_roles_get,
|
||||
},
|
||||
get_config, Config,
|
||||
};
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use std::{process, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
use serenity::all::{ChunkGuildFilter, GuildId, GuildMembersChunkEvent};
|
||||
use serenity::{
|
||||
all::{ChunkGuildFilter, GuildId, GuildMembersChunkEvent},
|
||||
async_trait,
|
||||
client::{Context, EventHandler},
|
||||
model::gateway::{GatewayIntents, Ready},
|
||||
model::gateway::GatewayIntents,
|
||||
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 skynet_discord_bot::{
|
||||
common::{
|
||||
database::{db_init, DataBase},
|
||||
set_roles::committee,
|
||||
},
|
||||
get_config, Config,
|
||||
};
|
||||
use std::{process, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
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::wolves::cns::get_wolves;
|
||||
use skynet_discord_bot::common::wolves::committees::get_cns;
|
||||
use skynet_discord_bot::{get_config, Config};
|
||||
use skynet_discord_bot::{
|
||||
common::{
|
||||
database::{db_init, DataBase},
|
||||
wolves::{cns::get_wolves, committees::get_cns},
|
||||
},
|
||||
get_config, Config,
|
||||
};
|
||||
use std::{process, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
use skynet_discord_bot::common::database::db_init;
|
||||
use skynet_discord_bot::common::minecraft::{get_minecraft_config, update_server, whitelist_wipe};
|
||||
use skynet_discord_bot::get_config;
|
||||
use skynet_discord_bot::{
|
||||
common::{
|
||||
database::db_init,
|
||||
minecraft::{get_minecraft_config, update_server, whitelist_wipe},
|
||||
},
|
||||
get_config,
|
||||
};
|
||||
use std::collections::HashSet;
|
||||
|
||||
#[tokio::main]
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
use serenity::all::{ChunkGuildFilter, GuildId};
|
||||
use serenity::{
|
||||
async_trait,
|
||||
client::{Context, EventHandler},
|
||||
model::gateway::{GatewayIntents, Ready},
|
||||
Client,
|
||||
};
|
||||
use skynet_discord_bot::common::server_icon::{get_config_icons, update_icon};
|
||||
use skynet_discord_bot::{
|
||||
common::database::{db_init, DataBase},
|
||||
common::{
|
||||
database::{db_init, DataBase},
|
||||
server_icon::{get_config_icons, update_icon},
|
||||
},
|
||||
get_config, Config,
|
||||
};
|
||||
use std::{process, sync::Arc};
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
use serenity::all::{ChunkGuildFilter, GuildId, GuildMembersChunkEvent};
|
||||
use serenity::{
|
||||
all::{ChunkGuildFilter, GuildId, GuildMembersChunkEvent},
|
||||
async_trait,
|
||||
client::{Context, EventHandler},
|
||||
model::gateway::{GatewayIntents, Ready},
|
||||
model::gateway::GatewayIntents,
|
||||
Client,
|
||||
};
|
||||
use skynet_discord_bot::common::database::{db_init, get_server_config_bulk, DataBase};
|
||||
use skynet_discord_bot::common::set_roles::normal;
|
||||
use skynet_discord_bot::{get_config, Config};
|
||||
use skynet_discord_bot::{
|
||||
common::{
|
||||
database::{db_init, get_server_config_bulk, DataBase},
|
||||
set_roles::normal,
|
||||
},
|
||||
get_config, Config,
|
||||
};
|
||||
use std::{process, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
|
@ -70,6 +74,6 @@ async fn check_bulk(ctx: &Context) {
|
|||
let db = db_lock.read().await;
|
||||
|
||||
for server_config in get_server_config_bulk(&db).await {
|
||||
normal::update_server(&ctx, &server_config, &[], &[]).await;
|
||||
normal::update_server(ctx, &server_config, &[], &[]).await;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction};
|
||||
use serenity::client::Context;
|
||||
use skynet_discord_bot::common::database::{get_server_config, DataBase, Servers};
|
||||
use skynet_discord_bot::common::set_roles::normal::update_server;
|
||||
use skynet_discord_bot::common::wolves::cns::get_wolves;
|
||||
use serenity::{
|
||||
all::{CommandDataOption, CommandDataOptionValue, CommandInteraction},
|
||||
client::Context,
|
||||
};
|
||||
use skynet_discord_bot::common::{
|
||||
database::{get_server_config, DataBase, Servers},
|
||||
set_roles::normal::update_server,
|
||||
wolves::cns::get_wolves,
|
||||
};
|
||||
use sqlx::{Error, Pool, Sqlite};
|
||||
|
||||
pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
|
||||
|
|
|
@ -5,8 +5,7 @@ pub mod committee {
|
|||
use serenity::all::{
|
||||
CommandDataOption, CommandDataOptionValue, CommandInteraction, CommandOptionType, Context, CreateCommand, CreateCommandOption,
|
||||
};
|
||||
use skynet_discord_bot::common::database::DataBase;
|
||||
use skynet_discord_bot::common::set_roles::committee::db_roles_get;
|
||||
use skynet_discord_bot::common::{database::DataBase, set_roles::committee::db_roles_get};
|
||||
|
||||
pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
|
||||
let sub_options = if let Some(CommandDataOption {
|
||||
|
@ -85,9 +84,13 @@ pub mod servers {
|
|||
// get the list of all the current clubs/socs
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::all::{CommandInteraction, CommandOptionType, Context, CreateCommand, CreateCommandOption};
|
||||
use skynet_discord_bot::common::database::{get_server_config_bulk, DataBase};
|
||||
use skynet_discord_bot::common::set_roles::committee::get_committees;
|
||||
use skynet_discord_bot::get_now_iso;
|
||||
use skynet_discord_bot::{
|
||||
common::{
|
||||
database::{get_server_config_bulk, DataBase},
|
||||
set_roles::committee::get_committees,
|
||||
},
|
||||
get_now_iso,
|
||||
};
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use std::collections::HashMap;
|
||||
|
||||
|
|
|
@ -9,11 +9,17 @@ pub(crate) mod user {
|
|||
use super::*;
|
||||
use crate::commands::wolves::link::get_server_member_discord;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction};
|
||||
use serenity::model::id::UserId;
|
||||
use skynet_discord_bot::common::database::Wolves;
|
||||
use skynet_discord_bot::common::minecraft::{whitelist_update, Minecraft};
|
||||
use skynet_discord_bot::Config;
|
||||
use serenity::{
|
||||
all::{CommandDataOption, CommandDataOptionValue, CommandInteraction},
|
||||
model::id::UserId,
|
||||
};
|
||||
use skynet_discord_bot::{
|
||||
common::{
|
||||
database::Wolves,
|
||||
minecraft::{whitelist_update, Minecraft},
|
||||
},
|
||||
Config,
|
||||
};
|
||||
use sqlx::Error;
|
||||
|
||||
pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
|
||||
|
@ -185,14 +191,17 @@ pub(crate) mod server {
|
|||
use super::*;
|
||||
|
||||
pub(crate) mod add {
|
||||
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction, CommandOptionType, CreateCommand, CreateCommandOption};
|
||||
use serenity::model::id::GuildId;
|
||||
use serenity::{
|
||||
all::{CommandDataOption, CommandDataOptionValue, CommandInteraction, CommandOptionType, CreateCommand, CreateCommandOption},
|
||||
model::id::GuildId,
|
||||
};
|
||||
use sqlx::Error;
|
||||
// this is to managfe the server side of commands related to minecraft
|
||||
use super::*;
|
||||
use skynet_discord_bot::common::minecraft::update_server;
|
||||
use skynet_discord_bot::common::minecraft::Minecraft;
|
||||
use skynet_discord_bot::Config;
|
||||
use skynet_discord_bot::{
|
||||
common::minecraft::{update_server, Minecraft},
|
||||
Config,
|
||||
};
|
||||
|
||||
pub fn register() -> CreateCommand {
|
||||
CreateCommand::new("minecraft_add")
|
||||
|
@ -260,12 +269,14 @@ pub(crate) mod server {
|
|||
}
|
||||
|
||||
pub(crate) mod list {
|
||||
use serenity::all::CommandInteraction;
|
||||
use serenity::builder::CreateCommand;
|
||||
use serenity::client::Context;
|
||||
use skynet_discord_bot::common::database::DataBase;
|
||||
use skynet_discord_bot::common::minecraft::{get_minecraft_config_server, server_information};
|
||||
use skynet_discord_bot::Config;
|
||||
use serenity::{all::CommandInteraction, builder::CreateCommand, client::Context};
|
||||
use skynet_discord_bot::{
|
||||
common::{
|
||||
database::DataBase,
|
||||
minecraft::{get_minecraft_config_server, server_information},
|
||||
},
|
||||
Config,
|
||||
};
|
||||
|
||||
pub fn register() -> CreateCommand {
|
||||
CreateCommand::new("minecraft_list")
|
||||
|
@ -320,12 +331,13 @@ pub(crate) mod server {
|
|||
}
|
||||
|
||||
pub(crate) mod delete {
|
||||
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction, CommandOptionType, CreateCommandOption};
|
||||
use serenity::builder::CreateCommand;
|
||||
use serenity::client::Context;
|
||||
use serenity::model::id::GuildId;
|
||||
use skynet_discord_bot::common::database::DataBase;
|
||||
use skynet_discord_bot::common::minecraft::Minecraft;
|
||||
use serenity::{
|
||||
all::{CommandDataOption, CommandDataOptionValue, CommandInteraction, CommandOptionType, CreateCommandOption},
|
||||
builder::CreateCommand,
|
||||
client::Context,
|
||||
model::id::GuildId,
|
||||
};
|
||||
use skynet_discord_bot::common::{database::DataBase, minecraft::Minecraft};
|
||||
use sqlx::{Error, Pool, Sqlite};
|
||||
|
||||
pub fn register() -> CreateCommand {
|
||||
|
|
|
@ -142,8 +142,7 @@ pub mod edit {
|
|||
pub mod list {}
|
||||
|
||||
pub mod tools {
|
||||
use serenity::client::Context;
|
||||
use serenity::model::guild::Member;
|
||||
use serenity::{client::Context, model::guild::Member};
|
||||
use skynet_discord_bot::common::database::RoleAdder;
|
||||
use sqlx::{Pool, Sqlite};
|
||||
|
||||
|
|
|
@ -113,8 +113,10 @@ pub(crate) mod user {
|
|||
|
||||
pub(crate) mod festival {
|
||||
use serenity::all::{CommandInteraction, Context};
|
||||
use skynet_discord_bot::common::server_icon::{get_config_icons, update_icon::get_festival};
|
||||
use skynet_discord_bot::Config;
|
||||
use skynet_discord_bot::{
|
||||
common::server_icon::{get_config_icons, update_icon::get_festival},
|
||||
Config,
|
||||
};
|
||||
|
||||
// use this to return what current festivals are active?
|
||||
pub async fn run(_command: &CommandInteraction, ctx: &Context) -> String {
|
||||
|
|
|
@ -4,11 +4,16 @@ use lettre::{
|
|||
Message, SmtpTransport, Transport,
|
||||
};
|
||||
use maud::html;
|
||||
use serenity::all::CommandOptionType;
|
||||
use serenity::builder::CreateCommandOption;
|
||||
use serenity::{builder::CreateCommand, client::Context, model::id::UserId};
|
||||
use skynet_discord_bot::common::database::{DataBase, Wolves, WolvesVerify};
|
||||
use skynet_discord_bot::{get_now_iso, random_string, Config};
|
||||
use serenity::{
|
||||
all::CommandOptionType,
|
||||
builder::{CreateCommand, CreateCommandOption},
|
||||
client::Context,
|
||||
model::id::UserId,
|
||||
};
|
||||
use skynet_discord_bot::{
|
||||
common::database::{DataBase, Wolves, WolvesVerify},
|
||||
get_now_iso, random_string, Config,
|
||||
};
|
||||
use sqlx::{Pool, Sqlite};
|
||||
|
||||
pub mod link {
|
||||
|
@ -298,11 +303,14 @@ pub mod link_docs {
|
|||
pub mod verify {
|
||||
use super::*;
|
||||
use crate::commands::wolves::link::{db_pending_clear_expired, get_server_member_discord, get_verify_from_db};
|
||||
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction};
|
||||
use serenity::model::user::User;
|
||||
use skynet_discord_bot::common::database::get_server_config;
|
||||
use skynet_discord_bot::common::database::{ServerMembersWolves, Servers};
|
||||
use skynet_discord_bot::common::wolves::committees::Committees;
|
||||
use serenity::{
|
||||
all::{CommandDataOption, CommandDataOptionValue, CommandInteraction},
|
||||
model::user::User,
|
||||
};
|
||||
use skynet_discord_bot::common::{
|
||||
database::{get_server_config, ServerMembersWolves, Servers},
|
||||
wolves::committees::Committees,
|
||||
};
|
||||
use sqlx::Error;
|
||||
|
||||
pub async fn run(command: &CommandInteraction, ctx: &Context) -> String {
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
use crate::Config;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::model::guild;
|
||||
use serenity::model::id::{ChannelId, GuildId, RoleId, UserId};
|
||||
use serenity::prelude::TypeMapKey;
|
||||
use sqlx::sqlite::{SqliteConnectOptions, SqlitePoolOptions, SqliteRow};
|
||||
use sqlx::{Error, FromRow, Pool, Row, Sqlite};
|
||||
use std::str::FromStr;
|
||||
use std::sync::Arc;
|
||||
use serenity::{
|
||||
model::{
|
||||
guild,
|
||||
id::{ChannelId, GuildId, RoleId, UserId},
|
||||
},
|
||||
prelude::TypeMapKey,
|
||||
};
|
||||
use sqlx::{
|
||||
sqlite::{SqliteConnectOptions, SqlitePoolOptions, SqliteRow},
|
||||
Error, FromRow, Pool, Row, Sqlite,
|
||||
};
|
||||
use std::{str::FromStr, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
pub struct DataBase;
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
use crate::common::set_roles::normal::get_server_member_bulk;
|
||||
use crate::Config;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::{common::set_roles::normal::get_server_member_bulk, Config};
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use serenity::model::id::GuildId;
|
||||
use sqlx::sqlite::SqliteRow;
|
||||
use sqlx::{Error, FromRow, Pool, Row, Sqlite};
|
||||
use sqlx::{sqlite::SqliteRow, Error, FromRow, Pool, Row, Sqlite};
|
||||
|
||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||
pub struct Minecraft {
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
// this code is taken from https://github.com/MCorange99/svg2colored-png/tree/main
|
||||
// I was unable to figure out how to use usvg myself so younked it from here.
|
||||
|
||||
use std::ffi::OsStr;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
// use clap::builder::OsStr;
|
||||
use color_eyre::{eyre::bail, Result};
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
pub mod normal {
|
||||
use crate::common::database::{DataBase, ServerMembersWolves, Servers, Wolves};
|
||||
use crate::get_now_iso;
|
||||
use serenity::client::Context;
|
||||
use serenity::model::id::{GuildId, RoleId, UserId};
|
||||
use crate::{
|
||||
common::database::{DataBase, ServerMembersWolves, Servers, Wolves},
|
||||
get_now_iso,
|
||||
};
|
||||
use serenity::{
|
||||
client::Context,
|
||||
model::id::{GuildId, RoleId, UserId},
|
||||
};
|
||||
use sqlx::{Pool, Sqlite};
|
||||
|
||||
struct RolesChange {
|
||||
|
@ -152,21 +156,22 @@ pub mod normal {
|
|||
|
||||
// for updating committee members
|
||||
pub mod committee {
|
||||
use crate::common::database::{get_channel_from_row, get_role_from_row, DataBase, Wolves};
|
||||
use crate::common::wolves::committees::Committees;
|
||||
use crate::Config;
|
||||
use crate::{
|
||||
common::{
|
||||
database::{get_channel_from_row, get_role_from_row, DataBase, Wolves},
|
||||
wolves::committees::Committees,
|
||||
},
|
||||
Config,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serenity::all::EditRole;
|
||||
use serenity::builder::CreateChannel;
|
||||
use serenity::client::Context;
|
||||
use serenity::model::channel::ChannelType;
|
||||
use serenity::model::guild::Member;
|
||||
use serenity::model::id::ChannelId;
|
||||
use serenity::model::prelude::RoleId;
|
||||
use sqlx::sqlite::SqliteRow;
|
||||
use sqlx::{Error, FromRow, Pool, Row, Sqlite};
|
||||
use serenity::{
|
||||
all::EditRole,
|
||||
builder::CreateChannel,
|
||||
client::Context,
|
||||
model::{channel::ChannelType, guild::Member, id::ChannelId, prelude::RoleId},
|
||||
};
|
||||
use sqlx::{sqlite::SqliteRow, Error, FromRow, Pool, Row, Sqlite};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub async fn check_committee(ctx: &Context) {
|
||||
let db_lock = {
|
||||
|
@ -187,7 +192,7 @@ pub mod committee {
|
|||
// because to use it to update a single user we need to pre-get the members of teh server
|
||||
let mut members = server.members(&ctx, None, None).await.unwrap_or_default();
|
||||
|
||||
update_committees(&db, &ctx, &config_global, &mut members).await;
|
||||
update_committees(&db, ctx, &config_global, &mut members).await;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -342,11 +347,11 @@ pub mod committee {
|
|||
for role in &roles_current {
|
||||
roles_current_id.push(role.id.to_owned());
|
||||
if !roles_required.contains(&role.id) {
|
||||
if role.id == committee_member {
|
||||
if !on_committee {
|
||||
roles_rem.push(role.id.to_owned());
|
||||
}
|
||||
if role.id == committee_member && on_committee {
|
||||
continue;
|
||||
}
|
||||
|
||||
roles_rem.push(role.id.to_owned());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,11 +48,14 @@ async fn add_users_wolves(db: &Pool<Sqlite>, user: &WolvesResultUserMin) {
|
|||
This is getting data for Clubs and Socs
|
||||
*/
|
||||
pub mod cns {
|
||||
use crate::common::database::{get_server_config_bulk, DataBase, ServerMembers, ServerMembersWolves, Servers};
|
||||
use crate::common::wolves::{add_users_wolves, WolvesResultUserMin};
|
||||
use crate::Config;
|
||||
use serenity::client::Context;
|
||||
use serenity::model::id::GuildId;
|
||||
use crate::{
|
||||
common::{
|
||||
database::{get_server_config_bulk, DataBase, ServerMembers, ServerMembersWolves, Servers},
|
||||
wolves::{add_users_wolves, WolvesResultUserMin},
|
||||
},
|
||||
Config,
|
||||
};
|
||||
use serenity::{client::Context, model::id::GuildId};
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
|
@ -191,8 +194,7 @@ pub mod cns {
|
|||
Get and store the data on C&S committees
|
||||
*/
|
||||
pub mod committees {
|
||||
use crate::common::database::DataBase;
|
||||
use crate::Config;
|
||||
use crate::{common::database::DataBase, Config};
|
||||
use serenity::client::Context;
|
||||
use sqlx::{Pool, Sqlite};
|
||||
|
||||
|
|
|
@ -3,8 +3,10 @@ pub mod common;
|
|||
use chrono::{Datelike, SecondsFormat, Utc};
|
||||
use dotenvy::dotenv;
|
||||
use rand::{distr::Alphanumeric, rng, Rng};
|
||||
use serenity::model::id::{ChannelId, GuildId, RoleId};
|
||||
use serenity::prelude::TypeMapKey;
|
||||
use serenity::{
|
||||
model::id::{ChannelId, GuildId, RoleId},
|
||||
prelude::TypeMapKey,
|
||||
};
|
||||
use std::{env, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
|
|
36
src/main.rs
36
src/main.rs
|
@ -1,39 +1,33 @@
|
|||
pub mod commands;
|
||||
|
||||
use crate::commands::role_adder::tools::on_role_change;
|
||||
use crate::commands::server_icon::user::current::icon::get_current_icon;
|
||||
use chrono::{Days, SecondsFormat, TimeDelta, Utc};
|
||||
use serenity::all::{
|
||||
ActivityData, Command, CommandDataOptionValue, CreateAttachment, CreateMessage, EditInteractionResponse, GuildId, GuildMemberUpdateEvent,
|
||||
GuildMembersChunkEvent, Interaction,
|
||||
};
|
||||
use serenity::{
|
||||
all::{Command, CommandDataOptionValue, CreateMessage, EditInteractionResponse, Interaction},
|
||||
async_trait,
|
||||
client::{Context, EventHandler},
|
||||
gateway::ChunkGuildFilter,
|
||||
gateway::{ActivityData, ChunkGuildFilter},
|
||||
model::{
|
||||
event::GuildMemberUpdateEvent,
|
||||
gateway::{GatewayIntents, Ready},
|
||||
guild::Member,
|
||||
id::GuildId,
|
||||
user::OnlineStatus,
|
||||
},
|
||||
Client,
|
||||
};
|
||||
use skynet_discord_bot::common::database::{db_init, get_server_config, get_server_config_bulk, get_server_member, DataBase};
|
||||
use skynet_discord_bot::common::server_icon::{get_config_icons, update_icon};
|
||||
use skynet_discord_bot::common::set_roles::committee::update_committees;
|
||||
use skynet_discord_bot::common::set_roles::{committee, normal};
|
||||
use skynet_discord_bot::common::wolves::cns::get_wolves;
|
||||
use skynet_discord_bot::common::wolves::committees::{get_cns, Committees};
|
||||
use skynet_discord_bot::{get_config, Config};
|
||||
use skynet_discord_bot::{
|
||||
common::{
|
||||
database::{db_init, get_server_config, get_server_member, DataBase},
|
||||
set_roles::committee::update_committees,
|
||||
wolves::committees::Committees,
|
||||
},
|
||||
get_config, Config,
|
||||
};
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
struct Handler {
|
||||
is_loop_running: AtomicBool,
|
||||
}
|
||||
struct Handler;
|
||||
|
||||
#[async_trait]
|
||||
impl EventHandler for Handler {
|
||||
|
@ -301,9 +295,7 @@ async fn main() {
|
|||
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 {
|
||||
is_loop_running: AtomicBool::new(false),
|
||||
})
|
||||
.event_handler(Handler)
|
||||
.cache_settings(serenity::cache::Settings::default())
|
||||
.await
|
||||
.expect("Error creating client");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue