Add pullAndRebuildSite command
This commit is contained in:
parent
eb43f48b84
commit
a1c3e7c047
2 changed files with 16 additions and 0 deletions
|
@ -122,6 +122,21 @@ async fn rebuildSite(ctx: &Context, msg: &Message) -> CommandResult {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
#[owners_only]
|
||||
#[allow(non_snake_case)]
|
||||
async fn pullAndRebuildSite(ctx: &Context, msg: &Message) -> CommandResult {
|
||||
Command::new("git")
|
||||
.current_dir(get_hugo_path())
|
||||
.arg("pull")
|
||||
.spawn()
|
||||
.expect("Failed to git pull")
|
||||
.wait()?;
|
||||
rebuild_site();
|
||||
msg.reply(&ctx.http, "Pulled and started site rebuild process!").await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[command]
|
||||
async fn challenge(ctx: &Context, msg: &Message) -> CommandResult {
|
||||
msg.reply(
|
||||
|
|
|
@ -51,6 +51,7 @@ impl EventHandler for Handler {
|
|||
hyogai,
|
||||
so,
|
||||
rebuildSite,
|
||||
pullAndRebuildSite,
|
||||
challenge,
|
||||
submit,
|
||||
images,
|
||||
|
|
Loading…
Add table
Reference in a new issue