mirror of
https://github.com/Expand-sys/mcbot
synced 2025-12-16 23:12:12 +11:00
aaa
This commit is contained in:
parent
71294988a0
commit
1d743e8d02
1 changed files with 32 additions and 0 deletions
32
commands/slashcommands/utility/query.js
Normal file
32
commands/slashcommands/utility/query.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
const { CommandInteraction, ApplicationCommandType, ApplicationCommandOptionType, EmbedBuilder } = require('discord.js');
|
||||
const { sendResponse, sendReply, channelSend } = require('../../../utils/utils');
|
||||
const path = require('path');
|
||||
const { Rcon } = require("rcon-client");
|
||||
const dig = require("gamedig")
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: `query`,
|
||||
description: `Fetch a the query response from server`,
|
||||
cooldown: 5,
|
||||
type: ApplicationCommandType.ChatInput,
|
||||
/**
|
||||
* @param {CommandInteraction} interaction
|
||||
*/
|
||||
async execute(interaction) {
|
||||
const { member, guild, options } = interaction
|
||||
await interaction.deferReply({ ephemeral: false }).catch(err => console.error(`There was a problem deferring an interaction: `, err));
|
||||
dig.query({
|
||||
type: 'minecraft',
|
||||
host: process.env.MCHOST,
|
||||
port: process.env.MCHOSTPORT,
|
||||
}).then((state) => {
|
||||
//console.log(state);
|
||||
//console.log(state.players)
|
||||
interaction.sendResponse(state)
|
||||
}).catch(async (error) => {
|
||||
console.log("Server is offline " + error);
|
||||
interaction.sendResponse("Server is offline")
|
||||
});
|
||||
},
|
||||
}
|
||||
Loading…
Reference in a new issue