1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 00:10:58 -05:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Toast
100a437e2a
Prevent MP function from throwing errors. 2023-08-12 19:46:03 +10:00
AnxietyisReal
8f2854bffa Add Custom Status to presence command 2023-08-12 18:28:48 +10:00
Toast
ee71798696 Add wake_device command 2023-08-12 18:17:51 +10:00
2 changed files with 17 additions and 1 deletions

View File

@ -83,6 +83,7 @@ export default async(client:TClient,Channel:string,Message:string,ServerName:str
const serverLog = client.channels.resolve(client.config.mainServer.channels.fs_server_log) as Discord.TextChannel; const serverLog = client.channels.resolve(client.config.mainServer.channels.fs_server_log) as Discord.TextChannel;
const playersOnServer = DSS.data.slots?.players.filter(x=>x.isUsed); const playersOnServer = DSS.data.slots?.players.filter(x=>x.isUsed);
const playersInCache = client.MPServerCache.players; const playersInCache = client.MPServerCache.players;
if (!playersOnServer) return console.error('[MPLoop] Empty filter, ignoring...'); // For the love of god, stop throwing errors everytime.
playersOnServer.forEach(player=>playerData.push(`**${player.name} ${player.isAdmin ? '| admin' : ''}**\nFarming for ${client.formatPlayerUptime(player.uptime)}`)); playersOnServer.forEach(player=>playerData.push(`**${player.name} ${player.isAdmin ? '| admin' : ''}**\nFarming for ${client.formatPlayerUptime(player.uptime)}`));
ServerName = client.MPServerCache.name; ServerName = client.MPServerCache.name;

View File

@ -91,6 +91,7 @@ export default {
case 1: return 'Streaming'; case 1: return 'Streaming';
case 2: return 'Listening to'; case 2: return 'Listening to';
case 3: return 'Watching'; case 3: return 'Watching';
//case 4: return 'Custom Status'; // Will be enabled once PR #9743 on D.JS repo merges in.
case 5: return 'Competing in'; case 5: return 'Competing in';
} }
}; };
@ -127,7 +128,14 @@ export default {
else i.edit(`Successfully compiled TypeScript files into JavaScript!\nUptime before restarting: **${client.formatTime(client.uptime as number, 3, {commas: true, longNames: true})}**`).then(()=>exec('pm2 restart Daggerbot', {windowsHide:true})) else i.edit(`Successfully compiled TypeScript files into JavaScript!\nUptime before restarting: **${client.formatTime(client.uptime as number, 3, {commas: true, longNames: true})}**`).then(()=>exec('pm2 restart Daggerbot', {windowsHide:true}))
}) })
}, },
file: ()=>interaction.reply({files:[`./src/database/${interaction.options.getString('name')}.json`]}).catch(()=>'Filesize is too large, upload cancelled.') file: ()=>interaction.reply({files:[`./src/database/${interaction.options.getString('name')}.json`]}).catch(()=>'Filesize is too large, upload cancelled.'),
wake_device: async()=>{
const i = await interaction.reply({content: 'Spawning a task...', fetchReply: true});
exec(`cd "../../Desktop/System Tools/wakemeonlan" && WakeMeOnLan.exe /wakeup ${interaction.options.getString('name',true)}`, {windowsHide:true}, (err:Error)=>{
if (err) i.edit(removeUsername(err.message))
else i.edit('Your device should be awake by now!\n||Don\'t blame me if it isn\'t on.||')
})
}
} as any)[interaction.options.getSubcommand()](); } as any)[interaction.options.getSubcommand()]();
}, },
data: new Discord.SlashCommandBuilder() data: new Discord.SlashCommandBuilder()
@ -149,6 +157,13 @@ export default {
.addSubcommand(x=>x .addSubcommand(x=>x
.setName('update') .setName('update')
.setDescription('Pull from repository and restart')) .setDescription('Pull from repository and restart'))
.addSubcommand(x=>x
.setName('wake_device')
.setDescription('Remotely wake up a device in the same network as the bot')
.addStringOption(x=>x
.setName('name')
.setDescription('Device name')
.setRequired(true)))
.addSubcommand(x=>x .addSubcommand(x=>x
.setName('statsgraph') .setName('statsgraph')
.setDescription('Edit the number of data points to pull') .setDescription('Edit the number of data points to pull')