mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-17 12:21:00 -05:00
Neato.
This commit is contained in:
parent
d503312882
commit
e49fd28d4e
@ -30,7 +30,7 @@ async function MPdata(client:TClient, interaction:Discord.ChatInputCommandIntera
|
|||||||
export default {
|
export default {
|
||||||
run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||||
if (interaction.channelId == '468835769092669461' && !client.isStaff(interaction.member) && ['status', 'players'].includes(interaction.options.getSubcommand())) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
({
|
({
|
||||||
@ -47,7 +47,7 @@ export default {
|
|||||||
{name: 'Version', value: `${FSserver0?.data.server.version.length == 0 ? '\u200b' : FSserver0.data.server.version}`, inline: true},
|
{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}
|
{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){
|
} catch (err){
|
||||||
console.log(err)
|
console.log(err)
|
||||||
interaction.reply('FSserver0 Error placeholder')
|
interaction.reply('FSserver0 Error placeholder')
|
||||||
|
@ -5,7 +5,6 @@ import TClient from '../client.js';
|
|||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
export default {
|
export default {
|
||||||
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
async run(client: TClient, interaction: Discord.ChatInputCommandInteraction<'cached'>){
|
||||||
// Host specification (L9-L22, L51-L66)
|
|
||||||
// Bytes conversion
|
// Bytes conversion
|
||||||
function formatBytes(bytes:number, decimals:number = 2) {
|
function formatBytes(bytes:number, decimals:number = 2) {
|
||||||
if (bytes === 0) return '0 Bytes';
|
if (bytes === 0) return '0 Bytes';
|
||||||
@ -20,7 +19,6 @@ export default {
|
|||||||
const osInfo = await si.osInfo();
|
const osInfo = await si.osInfo();
|
||||||
const currentLoad = await si.currentLoad();
|
const currentLoad = await si.currentLoad();
|
||||||
|
|
||||||
// Command usage (L25-L50)
|
|
||||||
const columns = ['Command name', 'Count'];
|
const columns = ['Command name', 'Count'];
|
||||||
const includedCommands = client.commands.filter(x=>x.uses).sort((a,b)=>b.uses - a.uses);
|
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})}**`);
|
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})}`})]}))
|
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')
|
.setName('statistics')
|
||||||
.setDescription('See a list of commands ordered by their usage or host stats')
|
.setDescription('See a list of commands ordered by their usage or host stats')
|
||||||
}
|
}
|
@ -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)
|
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){
|
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);
|
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}\`\`\``)
|
(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}\`\`\``)
|
||||||
}))
|
}))
|
||||||
|
Loading…
Reference in New Issue
Block a user