mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
notice for already updated
This commit is contained in:
parent
a3fe43c72c
commit
ef310b5f07
1 changed files with 2 additions and 1 deletions
34
commands/message/dev/update.js
Normal file
34
commands/message/dev/update.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
const { Constants, Utils } = require("detritus-client");
|
||||
const Permissions = Constants.Permissions;
|
||||
|
||||
const { createEmbed } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
|
||||
const { execSync } = require("child_process")
|
||||
|
||||
module.exports = {
|
||||
name: "update",
|
||||
metadata: {
|
||||
description: 'update bot',
|
||||
examples: ['update'],
|
||||
category: 'dev',
|
||||
usage: 'update'
|
||||
},
|
||||
onBefore: context => context.user.isClientOwner,
|
||||
onCancel: context =>
|
||||
context.reply(
|
||||
`${context.user.mention}, you are lacking the permission \`BOT_OWNER\`.`
|
||||
),
|
||||
run: async (context, args) => {
|
||||
await context.triggerTyping();
|
||||
let response = await editOrReply(context, createEmbed("loading", context, "Updating bot..."))
|
||||
try{
|
||||
const r = execSync("git pull")
|
||||
if(r.toString().includes("Already up to date.")) return await response.edit({embeds: [createEmbed("warning", context, "Already up to date.")]})
|
||||
return await response.edit({embeds: [createEmbed("success", context, "Update complete.")]})
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
return await response.edit({embeds: [createEmbed("error", context, "Update failed.")]})
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue