feat: added existence check to FeedExtension
This commit is contained in:
parent
8f4585f1e9
commit
3654649f98
1 changed files with 13 additions and 0 deletions
|
@ -86,6 +86,19 @@ class FeedExtension : Extension() {
|
|||
}
|
||||
return@action
|
||||
}
|
||||
if (SubscriptionRepository.exists(this.channel.id.value.toLong(), feedName) || SubscriptionRepository.existsWithUrl(this.channel.id.value.toLong(), feedUrl)) {
|
||||
this.respond {
|
||||
this.embeds.add(
|
||||
MessageUtil.getEmbed(
|
||||
EmbedColor.ERROR,
|
||||
"Feed already exists",
|
||||
"The feed \"${feedName}\" already exists",
|
||||
user.username
|
||||
)
|
||||
)
|
||||
}
|
||||
return@action
|
||||
}
|
||||
val id = SubscriptionRepository.write(
|
||||
SubscriptionData(
|
||||
0,
|
||||
|
|
Loading…
Reference in a new issue