-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmod.rs
63 lines (57 loc) · 1.67 KB
/
mod.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
pub mod ucm;
use std::{collections::HashSet};
use std::sync::Arc;
use log::error;
use serenity:: {
model::{
id::UserId,
channel::Message
},
framework:: {
Framework,
standard::{
macros::{
hook,
help
},
buckets::LimitedFor,
StandardFramework, HelpOptions, CommandGroup, CommandResult, help_commands, Args, DispatchError
}
},
client::Context
};
use crate::commands::ucm::UCM_GROUP;
#[help]
#[individual_command_tip = "Cow help command\n\n\
Add the command you want to learn more about to the help command\n"]
#[command_not_found_text = "Could not find command: `{}`."]
#[max_levenshtein_distance(2)]
#[lacking_permissions = "Nothing"]
#[strikethrough_commands_tip_in_dm = ""]
#[strikethrough_commands_tip_in_guild = "Strikethrough commands require elevated permissions."]
async fn cow_help(
context: &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).await;
Ok(())
}
#[hook]
async fn non_command(ctx: &Context, msg: &Message) {
crate::message_handler::non_command(ctx, msg).await;
}
pub async fn get_framework(pref: &str, app_id: UserId, owners: HashSet<UserId>) -> Arc<Box<dyn Framework + Sync + std::marker::Send>> {
Arc::new(Box::new(StandardFramework::new()
.configure(|c| c
.prefix(pref)
.on_mention(Some(app_id))
.owners(owners)
)
.help(&COW_HELP)
.group(&UCM_GROUP)
))
}