1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-09-29 08:20:59 -04:00
This commit is contained in:
AnxietyisReal 2023-04-20 18:48:29 +10:00
parent cd5413cda6
commit eea00ccd1f
3 changed files with 4 additions and 6 deletions

View File

@ -30,7 +30,7 @@ async function MPdata(client:TClient, interaction:Discord.ChatInputCommandIntera
export default {
run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
if (interaction.channelId == '468835769092669461' && !client.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) {
interaction.reply(`Please use <#739084625862852715> for \`/mp status/players\` commands to prevent clutter in this channel.`).then((msg)=>{setTimeout(()=>{interaction.deleteReply()}, 6000)});
interaction.reply(`Please use <#739084625862852715> for \`/mp status/players\` commands to prevent clutter in this channel.`).then(msg=>setTimeout(()=>interaction.deleteReply(), 6000));
return;
}
({
@ -47,7 +47,7 @@ export default {
{name: 'Version', value: `${FSserver0?.data.server.version.length == 0 ? '\u200b' : FSserver0.data.server.version}`, inline: true},
{name: 'In-game Time', value: `${('0' + Math.floor((FSserver0.data.server.dayTime/3600/1000))).slice(-2)}:${('0' + Math.floor((FSserver0.data.server.dayTime/60/1000)%60)).slice(-2)}`, inline: true}
)]})
} else if (FSserver0.data.server.name.length == 0) interaction.reply('Server is currently offline.')
} else if (FSserver0.data.server.name.length === 0) interaction.reply('Server is currently offline.')
} catch (err){
console.log(err)
interaction.reply('FSserver0 Error placeholder')

View File

@ -5,7 +5,6 @@ import TClient from '../client.js';
import os from 'node:os';
export default {
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
// Host specification (L9-L22, L51-L66)
// Bytes conversion
function formatBytes(bytes:number, decimals:number = 2) {
if (bytes === 0) return '0 Bytes';
@ -20,7 +19,6 @@ export default {
const osInfo = await si.osInfo();
const currentLoad = await si.currentLoad();
// Command usage (L25-L50)
const columns = ['Command name', 'Count'];
const includedCommands = client.commands.filter(x=>x.uses).sort((a,b)=>b.uses - a.uses);
if (includedCommands.size == 0) return interaction.reply(`No commands have been used yet.\nUptime: **${client.formatTime(client.uptime as number, 3, {longNames: true, commas: true})}**`);
@ -65,7 +63,7 @@ export default {
);
interaction.reply({embeds: [embed], fetchReply: true}).then(x=>x.edit({embeds: [new client.embed(x.embeds[0].data).setFooter({text: `Load time: ${client.formatTime(x.createdTimestamp - interaction.createdTimestamp, 2, {longNames: true, commas: true})}`})]}))
},
data: new SlashCommandBuilder()// Nice
data: new SlashCommandBuilder()
.setName('statistics')
.setDescription('See a list of commands ordered by their usage or host stats')
}

View File

@ -12,7 +12,7 @@ client.on('ready', async()=>{
setInterval(()=>guild.invites.fetch().then(invites=>invites.forEach(inv=>client.invites.set(inv.code, {uses: inv.uses, creator: inv.inviterId}))),300000)
});
if (client.config.botSwitches.registerCommands){
client.config.whitelistedServers.forEach((guildId)=>(client.guilds.cache.get(guildId) as Discord.Guild).commands.set(client.registry).catch((e:Error)=>{
client.config.whitelistedServers.forEach(guildId=>(client.guilds.cache.get(guildId) as Discord.Guild).commands.set(client.registry).catch((e:Error)=>{
console.log(`Couldn't register slash commands for ${guildId} because`, e.stack);
(client.channels.resolve(client.config.mainServer.channels.errors) as Discord.TextChannel).send(`Cannot register slash commands for **${client.guilds.cache.get(guildId).name}** (\`${guildId}\`):\n\`\`\`${e.message}\`\`\``)
}))