Skip to content

Commit 3f2b3b2

Browse files
fix: restart command with 2fa
Signed-off-by: Ar Rakin <[email protected]>
1 parent 2d0c4a2 commit 3f2b3b2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/typescript/commands/settings/RestartCommand.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,23 @@ class RestartCommand extends Command {
135135
}
136136

137137
public override async execute(context: Context): Promise<void> {
138+
const mfaKey = context.isChatInput() ? context.options.getString("credential_key") : "";
139+
140+
this.application.logger.debug("Conditions: ", !!getEnvData().TWO_FACTOR_AUTH_URL, !mfaKey);
141+
138142
if (
139143
getEnvData().TWO_FACTOR_AUTH_URL &&
140-
(!context.isChatInput() || context.options.getString("credential_key"))
144+
!mfaKey
141145
) {
142146
await context.error(
143147
"Please enter the credential server 2FA code to restart the bot" +
144148
(context.isLegacy() ? " using the slash command" : "") +
145149
"!"
146150
);
151+
147152
return;
148153
}
149154

150-
const mfaKey = context.isChatInput() ? context.options.getString("credential_key") : "";
151-
152155
const reply = await context.reply({
153156
embeds: [
154157
{

0 commit comments

Comments
 (0)