-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0e5a41
commit 8035804
Showing
7 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>root</artifactId> | ||
<groupId>tw.waterballsa.utopia</groupId> | ||
<version>${revision}</version> | ||
</parent> | ||
|
||
<artifactId>top-post</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>tw.waterballsa.utopia</groupId> | ||
<artifactId>commons</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>tw.waterballsa.utopia</groupId> | ||
<artifactId>discord-impl-jda</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
24 changes: 24 additions & 0 deletions
24
top-post/src/main/kotlin/tw/waterballsa/utopia/TopPostListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package tw.waterballsa.utopia.toppost | ||
|
||
import net.dv8tion.jda.api.events.message.react.MessageReactionAddEvent | ||
import org.springframework.stereotype.Component | ||
import tw.waterballsa.utopia.commons.config.WsaDiscordProperties | ||
import tw.waterballsa.utopia.jda.UtopiaListener | ||
|
||
const val goodEmoji = "\uD83D\uDC4D" | ||
|
||
|
||
@Component | ||
class TopPostListener(private val wsa: WsaDiscordProperties) : UtopiaListener() { | ||
|
||
override fun onMessageReactionAdd(event: MessageReactionAddEvent) { | ||
val channel = event.channel | ||
val parentChannel = channel.asThreadChannel().parentChannel | ||
if (wsa.topicPondChannelId == parentChannel.id && goodEmoji == (event.emoji.name)) { | ||
channel.sendMessage(goodEmoji).queue { | ||
it.delete().queue() | ||
} | ||
} | ||
} | ||
|
||
} |