Skip to content

Commit

Permalink
fix: bump mention
Browse files Browse the repository at this point in the history
  • Loading branch information
shiron-dev committed Apr 28, 2024
1 parent 2e3ef14 commit 52968a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/kotlin/dev/shiron/kotodiscord/command/bump/BumpCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class BumpCommand
cmd.send(
i18n.format(
"command.message.bump.msg",
"<#${config.channelId}>",
cmd.guild.getTextChannelById(config.channelId)?.asMention ?: "",
config.mentionId?.let { " (<@$it>)" } ?: "",
if (LocalDateTime.now().isAfter(job.execAt)) {
i18n.format("command.message.bump.after", BumpVars.BUMP_COMMAND_MENTION)
Expand Down Expand Up @@ -155,7 +155,7 @@ class BumpCommand
event.send(
i18n.format(
"command.message.bump.unseted",
"<#${config.channelId}>",
event.guild.getTextChannelById(config.channelId)?.asMention ?: "",
config.mentionId?.let { " (<@$it>)" } ?: "",
),
)
Expand Down Expand Up @@ -183,6 +183,16 @@ class BumpCommand

if (event.actionData.key == "select_mention") {
val mentionId = event.values.first()

if (event.guild.getTextChannelById(config.channelId) == null) {
event.send(
i18n.format(
"command.message.bump.error.text",
),
)
return
}

configRepository.save(config.copy(mentionId = mentionId.idLong))
event.send(
i18n.format(
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ command.message.bump.seted = {0}にbumpの通知を設定しました。
command.message.bump.unseted = {0}{1}に設定されているbumpの通知を解除しました。
command.message.bump.mention.seted = {0}にbumpの通知をメンションするように設定しました。
command.message.bump.mention.unseted = bumpの通知をメンションしないように設定しました。
command.message.bump.error.text = テキストチャンネルを指定してください

button.support = サポートサーバー

Expand Down

0 comments on commit 52968a8

Please sign in to comment.