refactor(client): simplify usage with deref
This commit is contained in:
@@ -59,7 +59,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
|
||||
commands.register(
|
||||
literal("eval").then(argument("code", string()).executes(|ctx: &Ctx| {
|
||||
let source = ctx.source.clone();
|
||||
let code = get_string(ctx, "code").unwrap();
|
||||
let code = get_string(ctx, "code").expect("argument should exist");
|
||||
tokio::spawn(async move {
|
||||
let source = source.lock().await;
|
||||
source.reply(&format!("{:?}", eval(&source.state.lua, &code).await));
|
||||
@@ -71,7 +71,7 @@ pub fn register(commands: &mut CommandDispatcher<Mutex<CommandSource>>) {
|
||||
commands.register(
|
||||
literal("exec").then(argument("code", string()).executes(|ctx: &Ctx| {
|
||||
let source = ctx.source.clone();
|
||||
let code = get_string(ctx, "code").unwrap();
|
||||
let code = get_string(ctx, "code").expect("argument should exist");
|
||||
tokio::spawn(async move {
|
||||
let source = source.lock().await;
|
||||
source.reply(&format!("{:?}", exec(&source.state.lua, &code).await));
|
||||
|
Reference in New Issue
Block a user