feat: add console output to logger and remove redundant deferReply in autorole command

This commit is contained in:
이정수 2026-04-10 10:25:55 +09:00
parent 1e31f83ff3
commit ad8b47d4ec
3 changed files with 26 additions and 14 deletions

View File

@ -29,7 +29,6 @@ class AutoRoleCommand extends Command {
} }
protected override async handle(interaction: ChatInputCommandInteraction, locale: SupportedLocale) { protected override async handle(interaction: ChatInputCommandInteraction, locale: SupportedLocale) {
await interaction.deferReply({ ephemeral: true });
const guild = interaction.guild!; const guild = interaction.guild!;
const dashboard = await generateAutoRoleDashboard(guild, locale); const dashboard = await generateAutoRoleDashboard(guild, locale);
await interaction.editReply({ await interaction.editReply({

View File

@ -53,10 +53,12 @@ export async function ensureGuildPaidForTrait(
const guildId = interaction.guildId; const guildId = interaction.guildId;
if (!guildId) { if (!guildId) {
await interaction.reply({ const content = '이 명령은 서버에서만 사용할 수 있습니다.';
content: '이 명령은 서버에서만 사용할 수 있습니다.', if (interaction.deferred || interaction.replied) {
ephemeral: true, await interaction.editReply({ content });
}); } else {
await interaction.reply({ content, ephemeral: true });
}
return false; return false;
} }
@ -70,10 +72,12 @@ export async function ensureGuildPaidForTrait(
const paid = ownership?.owner?.tier != null && ownership.owner.tier !== SubscriptionTier.FREE; const paid = ownership?.owner?.tier != null && ownership.owner.tier !== SubscriptionTier.FREE;
if (!paid) { if (!paid) {
await interaction.reply({ const content = '결제가 되지않았습니다';
content: '결제가 되지않았습니다', if (interaction.deferred || interaction.replied) {
ephemeral: true, await interaction.editReply({ content });
}); } else {
await interaction.reply({ content, ephemeral: true });
}
return false; return false;
} }
@ -193,10 +197,12 @@ export abstract class Command {
locale: SupportedLocale, locale: SupportedLocale,
): Promise<void> { ): Promise<void> {
if (this.guildOnly && !interaction.inGuild()) { if (this.guildOnly && !interaction.inGuild()) {
await interaction.reply({ const content = 'This command can only be used in a server.';
content: 'This command can only be used in a server.', if (interaction.deferred || interaction.replied) {
ephemeral: true, await interaction.editReply({ content });
}); } else {
await interaction.reply({ content, ephemeral: true });
}
return; return;
} }

View File

@ -37,6 +37,13 @@ ensureLogDir(logDir);
log4js.configure({ log4js.configure({
appenders: { appenders: {
console: {
type: 'stdout',
layout: {
type: 'pattern',
pattern: '%[[%p]%] %m',
},
},
file: { file: {
type: 'dateFile', type: 'dateFile',
filename: resolve(logDir, 'kord.log'), filename: resolve(logDir, 'kord.log'),
@ -50,7 +57,7 @@ log4js.configure({
}, },
}, },
categories: { categories: {
default: { appenders: ['file'], level }, default: { appenders: ['console', 'file'], level },
}, },
}); });