feat: added existence check to FeedExtension

This commit is contained in:
moonleay 2023-10-15 13:22:52 +02:00
parent 8f4585f1e9
commit 3654649f98

View file

@ -86,6 +86,19 @@ class FeedExtension : Extension() {
} }
return@action 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( val id = SubscriptionRepository.write(
SubscriptionData( SubscriptionData(
0, 0,