mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 00:10:58 -05:00
Provide uptime before restarting
This commit is contained in:
parent
7603d77239
commit
d7f5f2b984
@ -3,7 +3,8 @@ import { TClient } from 'src/client';
|
||||
export default {
|
||||
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||
if (!client.config.eval.whitelist.includes(interaction.user.id)) return client.youNeedRole(interaction, 'bottech');
|
||||
interaction.reply('Restarting...').then(()=>require('node:child_process').exec('pm2 restart Daggerbot'))
|
||||
client.userLevels.forceSave();
|
||||
interaction.reply(`Uptime before restarting: **${client.formatTime(client.uptime as number, 3, {commas: true, longNames: true})}**`).then(()=>require('node:child_process').exec('pm2 restart Daggerbot'))
|
||||
},
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('restart')
|
||||
|
@ -4,7 +4,7 @@ import { exec } from 'node:child_process';
|
||||
export default {
|
||||
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||
if (!client.config.eval.whitelist.includes(interaction.user.id)) return client.youNeedRole(interaction, 'bottech');
|
||||
const msg = await interaction.reply({content: 'Pulling...', fetchReply: true})
|
||||
const msg = await interaction.reply({content: 'Pulling from repository...', fetchReply: true})
|
||||
exec(
|
||||
'git pull',(err:Error,stdout)=>{
|
||||
if (err){
|
||||
@ -12,7 +12,7 @@ export default {
|
||||
} else if (stdout.includes('Already up to date')){
|
||||
msg.edit(`Pull aborted:\nUp to date with the repository`)
|
||||
} else {
|
||||
setTimeout(()=>{msg.edit('Restarting...').then(()=>require('node:child_process').exec('pm2 restart Daggerbot'))},1000)
|
||||
setTimeout(()=>{msg.edit(`Uptime before restarting: **${client.formatTime(client.uptime as number, 3, {commas: true, longNames: true})}**`).then(()=>require('node:child_process').exec('pm2 restart Daggerbot'))},1000)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user