mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-25 01:30:50 +00:00
Split youmubot-core
This commit is contained in:
parent
aec9cd130d
commit
84150cd82e
14 changed files with 56 additions and 38 deletions
44
youmubot-core/src/lib.rs
Normal file
44
youmubot-core/src/lib.rs
Normal file
|
@ -0,0 +1,44 @@
|
|||
use serenity::{
|
||||
framework::standard::{
|
||||
help_commands, macros::help, Args, CommandGroup, CommandResult, HelpOptions,
|
||||
},
|
||||
model::{channel::Message, id::UserId},
|
||||
};
|
||||
use std::collections::HashSet;
|
||||
use youmubot_prelude::*;
|
||||
|
||||
pub mod admin;
|
||||
pub mod community;
|
||||
mod db;
|
||||
pub mod fun;
|
||||
|
||||
pub use admin::ADMIN_GROUP;
|
||||
pub use community::COMMUNITY_GROUP;
|
||||
pub use fun::FUN_GROUP;
|
||||
|
||||
/// Sets up all databases in the client.
|
||||
pub fn setup(
|
||||
path: &std::path::Path,
|
||||
client: &serenity::client::Client,
|
||||
data: &mut youmubot_prelude::ShareMap,
|
||||
) -> serenity::framework::standard::CommandResult {
|
||||
db::SoftBans::insert_into(&mut *data, &path.join("soft_bans.yaml"))?;
|
||||
|
||||
// Create handler threads
|
||||
std::thread::spawn(admin::watch_soft_bans(client));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// A help command
|
||||
#[help]
|
||||
pub fn help(
|
||||
context: &mut Context,
|
||||
msg: &Message,
|
||||
args: Args,
|
||||
help_options: &'static HelpOptions,
|
||||
groups: &[&'static CommandGroup],
|
||||
owners: HashSet<UserId>,
|
||||
) -> CommandResult {
|
||||
help_commands::with_embeds(context, msg, args, help_options, groups, owners)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue