-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import { Command } from "./types/Command"; | ||
import { List } from "./commands/List"; | ||
import { Online } from "./commands/Online"; | ||
import { PlayerAdd } from "./commands/PlayerAdd"; | ||
import { PlayerRemove } from "./commands/PlayerRemove"; | ||
import { Status } from "./commands/Status"; | ||
|
||
export const Commands: Command[] = [List, PlayerAdd, PlayerRemove, Status]; | ||
export const Commands: Command[] = [List, Online, PlayerAdd, PlayerRemove, Status]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { CommandInteraction, Client } from "discord.js"; | ||
import { ApplicationCommandType, ApplicationCommandOptionType } from 'discord-api-types/v10'; | ||
import { Command } from "../types/Command"; | ||
import { rcon, verifyConnection } from '../setRCON'; | ||
|
||
export const Online: Command = { | ||
name: "online", | ||
description: "Lists the players online in the Minecraft Server", | ||
type: ApplicationCommandType.ChatInput, | ||
run: async (client: Client, interaction: CommandInteraction) => { | ||
const connectStatus = await verifyConnection(); | ||
|
||
if (!connectStatus) { | ||
await interaction.reply({ | ||
content: "NOT CONNECTED to Minecraft Server!", | ||
ephemeral: true, | ||
}); | ||
return; | ||
} | ||
|
||
const res = await rcon.send("list").catch(console.error); | ||
|
||
await interaction.reply({ | ||
ephemeral: true, | ||
content: res ? res : "ERROR: Missing response", | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters