Skip to content

Commit

Permalink
Discord clickable help examples, validation messages (#1787)
Browse files Browse the repository at this point in the history
* Discord clickable help examples, validation messages

* Add back join alias
  • Loading branch information
taahamahdi authored Dec 10, 2023
1 parent 7458529 commit 6f6a11f
Show file tree
Hide file tree
Showing 55 changed files with 805 additions and 514 deletions.
6 changes: 3 additions & 3 deletions src/commands/admin/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import type BaseCommand from "../interfaces/base_command";
import type CommandArgs from "../../interfaces/command_args";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("stats");
const COMMAND_NAME = "stats";
const logger = new IPCLogger(COMMAND_NAME);

export default class StatsCommand implements BaseCommand {
help = (guildID: string): HelpDocumentation => ({
name: "stats",
name: COMMAND_NAME,
description: i18n.translate(guildID, "command.stats.help.description"),
usage: "/stats",
examples: [],
priority: 1,
});
Expand Down
6 changes: 3 additions & 3 deletions src/commands/game_commands/end.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import type BaseCommand from "../interfaces/base_command";
import type CommandArgs from "../../interfaces/command_args";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("end");
const COMMAND_NAME = "end";
const logger = new IPCLogger(COMMAND_NAME);

export default class EndCommand implements BaseCommand {
aliases = ["stop", "e"];
Expand All @@ -25,9 +26,8 @@ export default class EndCommand implements BaseCommand {
];

help = (guildID: string): HelpDocumentation => ({
name: "end",
name: COMMAND_NAME,
description: i18n.translate(guildID, "command.end.help.description"),
usage: "/end",
examples: [],
priority: 1020,
});
Expand Down
6 changes: 3 additions & 3 deletions src/commands/game_commands/exp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ import type CommandArgs from "../../interfaces/command_args";
import type GameRound from "../../structures/game_round";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("exp");
const COMMAND_NAME = "exp";
const logger = new IPCLogger(COMMAND_NAME);

interface ExpModifier {
displayName: string;
Expand Down Expand Up @@ -329,9 +330,8 @@ export async function calculateTotalRoundExp(

export default class ExpCommand implements BaseCommand {
help = (guildID: string): HelpDocumentation => ({
name: "exp",
name: COMMAND_NAME,
description: i18n.translate(guildID, "command.exp.help.description"),
usage: "/exp",
examples: [],
priority: 50,
});
Expand Down
6 changes: 3 additions & 3 deletions src/commands/game_commands/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import type BaseCommand from "../interfaces/base_command";
import type CommandArgs from "../../interfaces/command_args";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("feedback");
const COMMAND_NAME = "feedback";
const logger = new IPCLogger(COMMAND_NAME);

const FEEDBACK_QUESTIONS: {
question: string;
Expand All @@ -42,14 +43,13 @@ export default class FeedbackCommand implements BaseCommand {
};

help = (guildID: string): HelpDocumentation => ({
name: COMMAND_NAME,
description: i18n.translate(
guildID,
"command.feedback.help.description",
),
examples: [],
name: "feedback",
priority: 500,
usage: "/feedback",
});

slashCommands = (): Array<
Expand Down
6 changes: 3 additions & 3 deletions src/commands/game_commands/forcehint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import type CommandArgs from "../../interfaces/command_args";
import type GameSession from "src/structures/game_session";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("forcehint");
const COMMAND_NAME = "forcehint";
const logger = new IPCLogger(COMMAND_NAME);

export default class ForceHintCommand implements BaseCommand {
aliases = ["fhint", "fh"];
Expand All @@ -32,12 +33,11 @@ export default class ForceHintCommand implements BaseCommand {
];

help = (guildID: string): HelpDocumentation => ({
name: "forcehint",
name: COMMAND_NAME,
description: i18n.translate(
guildID,
"command.forcehint.help.description",
),
usage: "/forcehint",
examples: [],
priority: 1009,
});
Expand Down
6 changes: 3 additions & 3 deletions src/commands/game_commands/forceskip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import type BaseCommand from "../interfaces/base_command";
import type CommandArgs from "../../interfaces/command_args";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("forceskip");
const COMMAND_NAME = "forceskip";
const logger = new IPCLogger(COMMAND_NAME);

export default class ForceSkipCommand implements BaseCommand {
aliases = ["fskip", "fs"];
Expand All @@ -28,12 +29,11 @@ export default class ForceSkipCommand implements BaseCommand {
];

help = (guildID: string): HelpDocumentation => ({
name: "forceskip",
name: COMMAND_NAME,
description: i18n.translate(
guildID,
"command.forceskip.help.description",
),
usage: "/forceskip",
examples: [],
priority: 1009,
});
Expand Down
9 changes: 5 additions & 4 deletions src/commands/game_commands/guess.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IPCLogger } from "../../logger";
import { clickableSlashCommand } from "../../helpers/utils";
import {
getInteractionValue,
sendDeprecatedTextCommandMessage,
Expand All @@ -17,7 +18,8 @@ import type BaseCommand from "../interfaces/base_command";
import type CommandArgs from "../../interfaces/command_args";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("guess");
const COMMAND_NAME = "guess";
const logger = new IPCLogger(COMMAND_NAME);

const MIN_GUESS_LENGTH = 1;
const MAX_GUESS_LENGTH = 500;
Expand All @@ -30,12 +32,11 @@ export default class GuessCommand implements BaseCommand {
};

help = (guildID: string): HelpDocumentation => ({
name: "guess",
name: COMMAND_NAME,
description: i18n.translate(guildID, "command.guess.help.description"),
usage: "/guess name:[name]",
examples: [
{
example: "`/guess name:madness`",
example: `${clickableSlashCommand(COMMAND_NAME)} name:madness`,
explanation: i18n.translate(
guildID,
"command.guess.help.example.song",
Expand Down
17 changes: 7 additions & 10 deletions src/commands/game_commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,25 @@ import type BaseCommand from "../interfaces/base_command";
import type CommandArgs from "../../interfaces/command_args";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("help");
const COMMAND_NAME = "help";
const logger = new IPCLogger(COMMAND_NAME);
const FIELDS_PER_EMBED = 8;
const excludedCommands: Array<string> = [];

export default class HelpCommand implements BaseCommand {
help = (guildID: string): HelpDocumentation => ({
name: "help",
name: COMMAND_NAME,
description: i18n.translate(guildID, "command.help.help.description"),
usage: `/help\naction:[${i18n.translate(
guildID,
"command.help.command",
)}]`,
examples: [
{
example: "`/help`",
example: clickableSlashCommand(COMMAND_NAME),
explanation: i18n.translate(
guildID,
"command.help.help.example.allCommands",
),
},
{
example: "`/help action:cutoff`",
example: `${clickableSlashCommand(COMMAND_NAME)} action:cutoff`,
explanation: i18n.translate(
guildID,
"command.help.help.example.sampleCommand",
Expand Down Expand Up @@ -172,7 +169,7 @@ export default class HelpCommand implements BaseCommand {

const helpManual = helpManualFunc(messageContext.guildID);

embedTitle = `\`${helpManual.usage}\``;
embedTitle = `/${helpManual.name}`;
embedDesc = helpManual.description;
embedActionRowComponents = helpManual.actionRowComponents;
if (helpManual.examples.length > 0) {
Expand Down Expand Up @@ -224,7 +221,7 @@ export default class HelpCommand implements BaseCommand {
{
play: clickableSlashCommand("play"),
options: clickableSlashCommand("options"),
help: clickableSlashCommand("help"),
help: clickableSlashCommand(COMMAND_NAME),
command: i18n.translate(
messageContext.guildID,
"command.help.command",
Expand Down
6 changes: 3 additions & 3 deletions src/commands/game_commands/hint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import type GameRound from "../../structures/game_round";
import type GameSession from "../../structures/game_session";
import type HelpDocumentation from "../../interfaces/help";

const logger = new IPCLogger("hint");
const COMMAND_NAME = "hint";
const logger = new IPCLogger(COMMAND_NAME);

function isHintMajority(
messageContext: MessageContext,
Expand Down Expand Up @@ -257,9 +258,8 @@ export default class HintCommand implements BaseCommand {
];

help = (guildID: string): HelpDocumentation => ({
name: "hint",
name: COMMAND_NAME,
description: i18n.translate(guildID, "command.hint.help.description"),
usage: "/hint",
examples: [],
priority: 1020,
});
Expand Down
Loading

0 comments on commit 6f6a11f

Please sign in to comment.