Operate on passed-in framework

This commit is contained in:
Lucy Bladen 2021-11-12 12:43:20 +00:00
parent 2110f643de
commit 459bd8068e
1 changed files with 5 additions and 7 deletions

View File

@ -53,7 +53,7 @@ impl TypeMapKey for ManifoldConfig {
#[commands(ping)] #[commands(ping)]
struct Core; struct Core;
pub async fn prepare_client(arguments: ArgMatches<'_>) -> ManifoldResult<Client> { pub async fn prepare_client(arguments: ArgMatches<'_>, mut framework: StandardFramework) -> ManifoldResult<Client> {
let bot_environment = arguments.value_of("environment").unwrap_or("Production").to_string(); let bot_environment = arguments.value_of("environment").unwrap_or("Production").to_string();
let config_file = format!("config/{}", arguments.value_of("config-file").unwrap_or("manifold.json")); let config_file = format!("config/{}", arguments.value_of("config-file").unwrap_or("manifold.json"));
if arguments.occurrences_of("make-config") > 0 { if arguments.occurrences_of("make-config") > 0 {
@ -102,17 +102,15 @@ pub async fn prepare_client(arguments: ArgMatches<'_>) -> ManifoldResult<Client>
Err(why) => panic!("Could not get HTTP application information - exiting: {:?}", why), Err(why) => panic!("Could not get HTTP application information - exiting: {:?}", why),
}; };
let framework = StandardFramework::new() framework = framework.configure(|c| c
.configure(|c| c
.with_whitespace(true) .with_whitespace(true)
.on_mention(Some(bot_id)) .on_mention(Some(bot_id))
.prefix(&prefix) .prefix(&prefix)
.owners(owners) .owners(owners)
.case_insensitivity(true) .case_insensitivity(true)
) ).before(before)
.before(before) .help(&MANIFOLD_HELP);
.help(&MANIFOLD_HELP) framework.group_add(&CORE_GROUP);
.group(&CORE_GROUP);
let client = Client::builder(&token) let client = Client::builder(&token)
.event_handler(Handler::new()) .event_handler(Handler::new())