Add toggles for chat bridge.

This commit is contained in:
Logan Gorence 2021-12-23 04:10:40 +00:00
parent b8c8097f58
commit 795e99ad4f
No known key found for this signature in database
GPG Key ID: 9743CEF10935949A
3 changed files with 6 additions and 0 deletions

View File

@ -66,6 +66,7 @@ class FoundationBifrostPlugin : JavaPlugin(), EventListener, Listener {
onDiscordReady() onDiscordReady()
} }
is MessageReceivedEvent -> { is MessageReceivedEvent -> {
if (!config.channel.bridge) return
// Prevent this bot from receiving its own messages and creating a feedback loop. // Prevent this bot from receiving its own messages and creating a feedback loop.
if (e.author.id == jda.selfUser.id) return if (e.author.id == jda.selfUser.id) return
@ -121,6 +122,7 @@ class FoundationBifrostPlugin : JavaPlugin(), EventListener, Listener {
@EventHandler @EventHandler
private fun onPlayerChat(e: AsyncChatEvent) { private fun onPlayerChat(e: AsyncChatEvent) {
if (!config.channel.bridge) return
val channel = getChannel() ?: return val channel = getChannel() ?: return
val message = e.message() val message = e.message()

View File

@ -16,6 +16,7 @@ data class BifrostAuthentication(
@Serializable @Serializable
data class BifrostChannel( data class BifrostChannel(
val id: String, val id: String,
val bridge: Boolean = true,
val sendStart: Boolean = true, val sendStart: Boolean = true,
val sendShutdown: Boolean = true, val sendShutdown: Boolean = true,
val sendPlayerJoin: Boolean = true, val sendPlayerJoin: Boolean = true,

View File

@ -9,6 +9,9 @@ channel:
# then be copied by right-clicking the channel and selecting "Copy ID". # then be copied by right-clicking the channel and selecting "Copy ID".
id: 123456789 id: 123456789
# Toggles the chat message bridge.
bridge: true
# Toggles for common events that generate notifications that are sent to the channel. # Toggles for common events that generate notifications that are sent to the channel.
sendStart: true sendStart: true
sendShutdown: true sendShutdown: true