Skip to content

Commit

Permalink
Add message for usage of commands only supporting slash commands (#1594)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brainicism authored Feb 27, 2023
1 parent 2177e82 commit 7d57249
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
4 changes: 4 additions & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,10 @@
"description": "I ran into an error while running this command.\nProvide this to a developer if this happens consistently:\n{{debugId}}",
"title": "Error Running Command"
},
"deprecatedTextCommand": {
"description": "Text commands are no longer supported for new commands. Try out the new and improved slash commands instead! If slash commands are not visible in the server, please re-invite KMQ to the server.",
"title": "Text Commands Deprecated"
},
"error": "Error",
"errorSelectingSong": {
"description": "Please try starting the round again. If the issue persists, report it in our official KMQ server.",
Expand Down
4 changes: 4 additions & 0 deletions i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,10 @@
"description": "이 명령어를 실행하는 동안 오류가 발생했습니다.\n이 문제가 계속 발생하면 개발자에게 다음 정보를 제공하세요.\n{{debugId}}",
"title": "명령어 실행 오류"
},
"deprecatedTextCommand": {
"description": "새 명령에 대해 텍스트 명령이 더 이상 지원되지 않습니다. 대신 새롭고 향상된 슬래시 명령을 사용해 보십시오! 서버에서 슬래시 명령어가 보이지 않는다면 KMQ를 서버에 다시 초대해 주세요.",
"title": "더 이상 사용되지 않는 텍스트 명령"
},
"error": "오류",
"errorSelectingSong": {
"description": "라운드를 다시 시작하십시오. 문제가 지속되면 공식 KMQ 서버에 보고하세요.",
Expand Down
12 changes: 10 additions & 2 deletions src/commands/game_commands/feedback.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import * as uuid from "uuid";
import { IPCLogger } from "../../logger";
import { getUserTag } from "../../helpers/discord_utils";
import {
getUserTag,
sendDeprecatedTextCommandMessage,
} from "../../helpers/discord_utils";
import { pathExists } from "../../helpers/utils";
import Eris from "eris";
import MessageContext from "../../structures/message_context";
import fs from "fs";
import i18n from "../../helpers/localization_manager";
import path from "path";
import type { DefaultSlashCommand } from "../interfaces/base_command";
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");
Expand Down Expand Up @@ -55,8 +60,11 @@ export default class FeedbackCommand implements BaseCommand {
},
];

call = (): void => {
call = async ({ message }: CommandArgs): Promise<void> => {
logger.warn("Text-based command not supported for feedback");
await sendDeprecatedTextCommandMessage(
MessageContext.fromMessage(message)
);
};

static sendFeedbackModal = async (
Expand Down
18 changes: 18 additions & 0 deletions src/helpers/discord_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1897,3 +1897,21 @@ export async function getUserTag(userID: string): Promise<string> {
const member = await fetchUser(userID);
return member ? `${member.username}#${member.discriminator}` : "";
}

/**
* @param messageContext - the messager context
*/
export async function sendDeprecatedTextCommandMessage(
messageContext: MessageContext
): Promise<Eris.Message<Eris.TextableChannel> | null> {
return sendErrorMessage(messageContext, {
title: i18n.translate(
messageContext.guildID,
"misc.failure.deprecatedTextCommand.title"
),
description: i18n.translate(
messageContext.guildID,
"misc.failure.deprecatedTextCommand.description"
),
});
}

0 comments on commit 7d57249

Please sign in to comment.