-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinfo.js
26 lines (25 loc) · 883 Bytes
/
info.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const { SlashCommandBuilder } = require("discord.js");
const { getGameData, isGameOngoing, sendMessage } = require("../util");
module.exports = {
data: new SlashCommandBuilder()
.setName("info")
.setDescription("Get information about the current game."),
async execute(interaction) {
const gameData = getGameData(interaction);
if (gameData) {
if(gameData.allowLinks === false){
return sendMessage(interaction, "Sorry, this command is unavailable when links are disallowed.", true);
} else {
return sendMessage(interaction, JSON.stringify(gameData), true);
}
} else if (!isGameOngoing(interaction)) {
return sendMessage(
interaction,
"There is no ongoing game in this channel.",
true
);
} else {
return sendMessage(interaction, "This isn't a game channel.", true);
}
},
};