feat: add console output to logger and remove redundant deferReply in autorole command
This commit is contained in:
parent
1e31f83ff3
commit
ad8b47d4ec
|
|
@ -29,7 +29,6 @@ class AutoRoleCommand extends Command {
|
|||
}
|
||||
|
||||
protected override async handle(interaction: ChatInputCommandInteraction, locale: SupportedLocale) {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
const guild = interaction.guild!;
|
||||
const dashboard = await generateAutoRoleDashboard(guild, locale);
|
||||
await interaction.editReply({
|
||||
|
|
|
|||
|
|
@ -53,10 +53,12 @@ export async function ensureGuildPaidForTrait(
|
|||
|
||||
const guildId = interaction.guildId;
|
||||
if (!guildId) {
|
||||
await interaction.reply({
|
||||
content: '이 명령은 서버에서만 사용할 수 있습니다.',
|
||||
ephemeral: true,
|
||||
});
|
||||
const content = '이 명령은 서버에서만 사용할 수 있습니다.';
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply({ content });
|
||||
} else {
|
||||
await interaction.reply({ content, ephemeral: true });
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -70,10 +72,12 @@ export async function ensureGuildPaidForTrait(
|
|||
const paid = ownership?.owner?.tier != null && ownership.owner.tier !== SubscriptionTier.FREE;
|
||||
|
||||
if (!paid) {
|
||||
await interaction.reply({
|
||||
content: '결제가 되지않았습니다',
|
||||
ephemeral: true,
|
||||
});
|
||||
const content = '결제가 되지않았습니다';
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply({ content });
|
||||
} else {
|
||||
await interaction.reply({ content, ephemeral: true });
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -193,10 +197,12 @@ export abstract class Command {
|
|||
locale: SupportedLocale,
|
||||
): Promise<void> {
|
||||
if (this.guildOnly && !interaction.inGuild()) {
|
||||
await interaction.reply({
|
||||
content: 'This command can only be used in a server.',
|
||||
ephemeral: true,
|
||||
});
|
||||
const content = 'This command can only be used in a server.';
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply({ content });
|
||||
} else {
|
||||
await interaction.reply({ content, ephemeral: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,13 @@ ensureLogDir(logDir);
|
|||
|
||||
log4js.configure({
|
||||
appenders: {
|
||||
console: {
|
||||
type: 'stdout',
|
||||
layout: {
|
||||
type: 'pattern',
|
||||
pattern: '%[[%p]%] %m',
|
||||
},
|
||||
},
|
||||
file: {
|
||||
type: 'dateFile',
|
||||
filename: resolve(logDir, 'kord.log'),
|
||||
|
|
@ -50,7 +57,7 @@ log4js.configure({
|
|||
},
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: ['file'], level },
|
||||
default: { appenders: ['console', 'file'], level },
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue