diff --git a/DiscordModules/Developers/update.js b/DiscordModules/Developers/update.js new file mode 100644 index 0000000..b98bf5e --- /dev/null +++ b/DiscordModules/Developers/update.js @@ -0,0 +1,34 @@ +const Command = require('../../src/structures/Command'); +const exec = require('shell-exec'); +module.exports = class Update extends Command { + constructor() { + super({ + name: 'update', + description: 'Execute shell commands', + aliases: [ 'up', 'pull' ], + module: 'Developers', + cooldown: 1, + guildOnly: false, + developerOnly: true, + nsfw: false + }); + } + + async command(ctx) { + const trying = await ctx.send( + `${ctx.utils.emotes.random.loading} Getting the latest updates from ${ctx.config.source.replace( + 'https://', + '' + )} ${ctx.utils.emotes.random.loading}` + ); + + await exec('git pull') + .then((r) => { + trying.edit('```fix\n' + r.stdout + '```'); + }) + .catch((error) => { + trying.edit(`Failed to get the latest updates.`); + console.error(error); + }); + } +}; diff --git a/utils/src/emotes.js b/utils/src/emotes.js index 885a141..3a6c525 100755 --- a/utils/src/emotes.js +++ b/utils/src/emotes.js @@ -71,6 +71,7 @@ module.exports = { dubai: 'Dubai' }, random: { - pin: '<:pin:350172480725581838>' + pin: '<:pin:350172480725581838>', + loading: '' } };