added multiple alert types:

new aler types:
   - twitter
   - job
This commit is contained in:
UnrealValentin
2021-06-02 20:42:12 +02:00
parent 126e630a80
commit cfad5c0611
8 changed files with 199 additions and 88 deletions

81
.idea/workspace.xml generated
View File

@@ -4,17 +4,15 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="Add file tests">
<change afterPath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/Message.kt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/webhook/DiscordWebhookEmbed.kt" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/test/kotlin/org/hmcore/webhook/DiscordWebhookEmbed.kt" afterDir="false" />
<list default="true" id="1aabf22b-2f57-46ac-9973-367d8668ffd3" name="Default Changelist" comment="twitter gods dont cancel me pls">
<change afterPath="$PROJECT_DIR$/src/main/java/org/hmcore/MessageType.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/test/kotlin/org/hmcore/serialization/EnumTest.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/hmcore/DiscordWebhook.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/org/hmcore/TwitterJob.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/hmcore/TwitterJob.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/Channels.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/Channels.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/Color.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/Color.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/webhook/WebhookCaller.kt" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/test/kotlin/org/hmcore/extensions/ColorTest.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/kotlin/org/hmcore/extensions/ColorTest.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/DataIO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/DataIO.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/Main.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/Main.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/OwnerCli.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/kotlin/org/hmcore/OwnerCli.kt" afterDir="false" />
</list>
<list id="44283a45-f406-407f-bce2-a31bb9bfc0cc" name="Changes by Valentin" comment="Changes by Valentin" />
<option name="SHOW_DIALOG" value="false" />
@@ -101,9 +99,10 @@
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
<option value="Kotlin Object" />
<option value="Kotlin File" />
<option value="Enum" />
<option value="Class" />
<option value="Kotlin Class" />
</list>
</option>
@@ -125,15 +124,15 @@
</file-type-list>
</component>
<component name="HighlightingSettingsPerFile">
<setting file="file://$PROJECT_DIR$/build.gradle" root0="SKIP_INSPECTION" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/Embed.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/File.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/Jsoup.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/test/kotlin/org/hmcore/extensions/EmbedTest.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/test/kotlin/org/hmcore/extensions/ColorTest.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/model/JobListingPreview.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/model/BlogPostPreview.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/test/kotlin/org/hmcore/extensions/ColorTest.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/build.gradle" root0="SKIP_INSPECTION" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/Color.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/test/kotlin/org/hmcore/extensions/EmbedTest.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/File.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/Embed.kt" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/src/main/kotlin/org/hmcore/extensions/Jsoup.kt" root0="FORCE_HIGHLIGHTING" />
</component>
<component name="MacroExpansionManager">
<option name="directoryName" value="o7p0t8es" />
@@ -186,7 +185,7 @@
<recent name="org" />
</key>
</component>
<component name="RunManager" selected="Gradle.DiscordWebhookEmbed.Webhook should not throw and return false if supplied invalid URL">
<component name="RunManager" selected="Kotlin.Main">
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
<option name="arquillianRunConfiguration">
<value>
@@ -198,12 +197,12 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="ColorTest" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<configuration name="BlogPostPreviewTest" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.hmcore.extensions.ColorTest&quot;" />
<option name="scriptParameters" value="--tests &quot;org.hmcore.model.BlogPostPreviewTest&quot;" />
<option name="taskDescriptions">
<list />
</option>
@@ -240,33 +239,12 @@
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
<configuration name="EmbedTest" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<configuration name="EnumTest.Enum serialization" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.hmcore.extensions.EmbedTest&quot;" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":test" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2" />
</configuration>
<configuration name="FileTest" type="GradleRunConfiguration" factoryName="Gradle" temporary="true">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="--tests &quot;org.hmcore.extensions.FileTest&quot;" />
<option name="scriptParameters" value="--tests &quot;org.hmcore.serialization.EnumTest.Enum serialization&quot;" />
<option name="taskDescriptions">
<list />
</option>
@@ -313,21 +291,28 @@
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="Main" type="JetRunConfigurationType" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="org.hmcore.Main" />
<module name="HytaleUpdateBot.main" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<list>
<item itemvalue="Gradle.ColorTest" />
<item itemvalue="Gradle.EmbedTest" />
<item itemvalue="Gradle.FileTest" />
<item itemvalue="Gradle.FileTest.Ensure exists should create a file if supplied with null but not write text" />
<item itemvalue="JUnit.All Tests" />
<item itemvalue="Gradle.DiscordWebhookEmbed.Webhook should not throw and return false if supplied invalid URL" />
<item itemvalue="Gradle.EnumTest.Enum serialization" />
<item itemvalue="Gradle.BlogPostPreviewTest" />
<item itemvalue="JUnit.All Tests" />
<item itemvalue="Kotlin.Main" />
</list>
<recent_temporary>
<list>
<item itemvalue="Kotlin.Main" />
<item itemvalue="Gradle.BlogPostPreviewTest" />
<item itemvalue="Gradle.EnumTest.Enum serialization" />
<item itemvalue="Gradle.DiscordWebhookEmbed.Webhook should not throw and return false if supplied invalid URL" />
<item itemvalue="Gradle.FileTest.Ensure exists should create a file if supplied with null but not write text" />
<item itemvalue="Gradle.FileTest" />
<item itemvalue="Gradle.EmbedTest" />
<item itemvalue="Gradle.ColorTest" />
</list>
</recent_temporary>
</component>

View File

@@ -0,0 +1,15 @@
package org.hmcore;
public enum MessageType {
INVALID (-1),
BLOGPOST(0),
TWITTER(1),
JOB_LISTING(2),
WEBSITE_CHANGED(3);
MessageType(int i) {
}
int i;
}

View File

@@ -30,7 +30,7 @@ public class TwitterJob implements Job {
if (!lastTweetID.equalsIgnoreCase(tweetID)) {
lastTweetID = tweetID;
Channels.INSTANCE.sentToAll(new MessageBuilder().append("https://twitter.com/Hytale/status/").append(tweetID).build());
Channels.INSTANCE.sentToAll(new MessageBuilder().append("https://twitter.com/Hytale/status/").append(tweetID).build(), MessageType.TWITTER);
}
} catch (Exception e) {

View File

@@ -8,6 +8,7 @@ import kotlinx.serialization.json.Json
import net.dv8tion.jda.api.EmbedBuilder
import net.dv8tion.jda.api.Permission
import net.dv8tion.jda.api.entities.Message
import org.hmcore.extensions.embed
import org.hmcore.extensions.toWebhook
import java.awt.Color
@@ -18,12 +19,22 @@ object Channels {
var channels: MutableList<DiscordChannel> = refreshChannelsFromDisk()
var serviceChannels: MutableList<ServiceChannel> = refreshServiceChannelsFromDisk()
fun sentToAll(messageEmbed: Message) {
messageEmbed.toWebhook().send(WEBHOOKS.blogPostsWebhookUrl)
fun sentToAll(messageEmbed: Message, msgType: MessageType) {
try {
messageEmbed.toWebhook().send(WEBHOOKS.blogPostsWebhookUrl)
} catch (e: Exception) {
e.printStackTrace()
Admin.sendDevMessage(embed {
title = "Error"
description = e.stackTraceToString()
color = Color.red
}, e.stackTrace.toString())
}
Main.jdas.forEach { jda ->
for (channel_pair in channels) {
try {
if(!channel_pair.type.equals(msgType)) continue
val channel = jda.getTextChannelById(channel_pair.id) ?: continue
val customMessage = channel_pair.message?.message ?: ""
@@ -126,7 +137,9 @@ object Channels {
else -> " @${channel.guild.getRoleById(it.mentionedRole ?: "")?.name}"
}
val publish = if (it.autoPublish) " (publish)" else ""
"**${channel.guild.name}** #${channel.name}${role}${publish}${
val type = " " + it.type.toString()
"**${channel.guild.name}** #${channel.name}${role}${publish}${type}${
if (it.message == null) {
""
} else {
@@ -150,11 +163,11 @@ object Channels {
fun testServerId(id: Long) =
Main.jdas.map { it.getTextChannelById(id) }.firstOrNull()
fun addChannel(id: Long, role: String?): DiscordChannel? {
if (channels.find { it.id == id } != null) {
fun addChannel(id: Long, msgType: MessageType): DiscordChannel? {
if (channels.find { it.id == id && it.type == msgType } != null) {
return null
}
val out = DiscordChannel(id, role)
val out = DiscordChannel(id, msgType)
channels.add(out)
saveChannels()
return out

View File

@@ -9,12 +9,16 @@ import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import java.io.File
const val channelVersion = 2.0
@Serializable
data class DiscordChannel(
val id: Long,
var type: MessageType,
var mentionedRole: String? = null,
var autoPublish: Boolean = false,
var message: CustomMessage? = null
var message: CustomMessage? = null,
var version: Double? = channelVersion
)
@Serializable

View File

@@ -1,5 +1,7 @@
package org.hmcore
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import org.hmcore.web.getNewBlogPosts
import net.dv8tion.jda.api.JDA
import net.dv8tion.jda.api.JDABuilder
@@ -9,12 +11,14 @@ import net.dv8tion.jda.api.requests.GatewayIntent
import net.dv8tion.jda.api.utils.ChunkingFilter
import net.dv8tion.jda.api.utils.MemberCachePolicy
import net.dv8tion.jda.api.utils.cache.CacheFlag
import org.hmcore.web.getNewJobListings
import org.quartz.CronScheduleBuilder.cronSchedule
import org.quartz.JobBuilder.newJob
import org.quartz.JobDetail
import org.quartz.Trigger
import org.quartz.TriggerBuilder.newTrigger
import org.quartz.impl.StdSchedulerFactory
import java.io.File
import javax.security.auth.login.LoginException
import kotlin.concurrent.timer
@@ -24,6 +28,27 @@ object Main {
@JvmStatic
fun main(args: Array<String>) {
if(args.isEmpty()) startBot() else
when(args[0]) {
"serverDataConvert1" -> serverDataConvert1()
else -> startBot()
}
}
fun serverDataConvert1() {
var file = File("servers.json")
if(!file.exists()) return
var content = ""
file.bufferedReader().readLines().forEach {
content += it
.replace(",\"mentionedRole\":", ",\"type\":\"BLOGPOST\",\"mentionedRole\":")
}
file.writeBytes(content.encodeToByteArray())
}
fun startBot() {
val builder = JDABuilder.createLight(
Admin.token,
GatewayIntent.GUILD_MESSAGES,
@@ -57,9 +82,15 @@ object Main {
}
})
timer("Updater", daemon = true, initialDelay = 0L, period = Admin.updateMs) {
timer("UpdaterBlogpost", daemon = true, initialDelay = 0L, period = Admin.updateMs) {
getNewBlogPosts()?.forEach {
Channels.sentToAll(MessageBuilder().setEmbed(it.toMessageEmbed()).build())
Channels.sentToAll(MessageBuilder().setEmbed(it.toMessageEmbed()).build(), MessageType.BLOGPOST)
}
}
timer("UpdaterJob", daemon = true, initialDelay = 0L, period = Admin.updateMs) {
getNewJobListings()?.forEach {
Channels.sentToAll(MessageBuilder().setEmbed(it.toMessageEmbed()).build(), MessageType.JOB_LISTING)
}
}
@@ -77,9 +108,7 @@ object Main {
.withSchedule(cronSchedule("0 0/5 * 1/1 * ? *"))
.build()
scheduler.scheduleJob(job, trigger);
scheduler.scheduleJob(job, trigger)
}
private fun configureMemoryUsage(builder: JDABuilder) {

View File

@@ -18,10 +18,38 @@ class OwnerCli : ListenerAdapter() {
val command = msg.removePrefix(prefix).split(Regex("\\s+"))
val channelId = event.message.channel.idLong
val msgType: MessageType
if(command.size < 2)
msgType = MessageType.INVALID
else msgType = when (command[1].lowercase()) {
"blogpost" -> MessageType.BLOGPOST
"twitter" -> MessageType.TWITTER
"job" -> MessageType.JOB_LISTING
"website" -> MessageType.WEBSITE_CHANGED
else -> MessageType.INVALID
}
when (command.first()) {
"categories" -> {
event.message.channel.sendMessage(EmbedBuilder()
.setTitle("Categories")
.setColor(Color.YELLOW)
.setAuthor(Admin.admin?.name, Admin.admin?.avatarUrl, Admin.admin?.avatarUrl)
.setDescription("Valid Categories:\n" +
" Blogpost\n" +
" Twitter\n" +
" Job - (changes of Job listings)\n" +
" Website - (if the content of some website or subdomain thats owned by hypixel studios gets changed) - soon\n")
.build()).queue()
return
}
"add" -> {
val result = Channels.addChannel(channelId, null)
if (msgType == MessageType.INVALID) {
event.message.channel.sendMessage("Please choose a valid category. List valid categories with ${prefix}categories").queue()
return
}
val result = Channels.addChannel(channelId, msgType)
if (result == null) {
event.message.channel.sendMessage("Already added.").queue()
} else {
@@ -30,7 +58,10 @@ class OwnerCli : ListenerAdapter() {
}
}
"remove" -> {
val result = Channels.channels.removeAll { it.id == channelId }
if (msgType == MessageType.INVALID) {
event.message.channel.sendMessage("Please choose a valid category. List valid categories with ${prefix}categories").queue()
}
val result = Channels.channels.removeAll { it.id == channelId && (it.type == msgType || it.type == MessageType.INVALID) }
Channels.saveChannels()
if (result) {
event.message.channel.sendMessage("Removed.").queue()
@@ -39,31 +70,37 @@ class OwnerCli : ListenerAdapter() {
}
}
"publish" -> {
val result = Channels.channels.find { it.id == channelId }
if (msgType == MessageType.INVALID) {
event.message.channel.sendMessage("Please choose a valid category. List valid categories with ${prefix}categories").queue()
}
val result = Channels.channels.find { it.id == channelId && it.type == msgType}
if (result != null) {
if (command.size > 1 && listOf("on", "off").contains(command[1])) {
result.autoPublish = command[1] == "on"
if (command.size > 2 && listOf("on", "off").contains(command[2])) {
result.autoPublish = command[2] == "on"
Channels.saveChannels()
event.message.channel.sendMessage("Auto publish is now ${command[1]}").queue()
} else {
event.message.channel.sendMessage("Usage: `${prefix}publish [on|off]`")
event.message.channel.sendMessage("Usage: `${prefix}publish [type] [on|off]`")
}
} else {
event.message.channel.sendMessage("Channel not registered.").queue()
}
}
"ping" -> {
val result = Channels.channels.find { it.id == channelId }
if (msgType == MessageType.INVALID) {
event.message.channel.sendMessage("Please choose a valid category. List valid categories with ${prefix}categories").queue()
}
val result = Channels.channels.find { it.id == channelId && it.type == msgType}
if (result != null) {
if (command.size > 1) {
val roles = event.message.guild.getRolesByName(command[1], false)
if (command.size > 2) {
val roles = event.message.guild.getRolesByName(command[2], false)
result.mentionedRole = when {
command[1] == "everyone" -> {
command[2] == "everyone" -> {
event.message.channel.sendMessage("Now pinging everyone.").queue()
"everyone"
}
command[1] == "none" -> {
command[2] == "none" -> {
event.message.channel.sendMessage("Now pinging none.").queue()
null
}
@@ -78,29 +115,35 @@ class OwnerCli : ListenerAdapter() {
}
Channels.saveChannels()
} else {
event.message.channel.sendMessage("Usage: `${prefix}ping [everyone|none|roleName]`")
event.message.channel.sendMessage("Usage: `${prefix}ping [type] [everyone|none|roleName]`")
}
} else {
event.message.channel.sendMessage("Channel is not registered.").queue()
}
}
"setMessage" -> {
val result = Channels.channels.find { it.id == channelId }
if (msgType == MessageType.INVALID) {
event.message.channel.sendMessage("Please choose a valid category. List valid categories with ${prefix}categories").queue()
}
val result = Channels.channels.find { it.id == channelId && it.type == msgType }
if (result != null) {
if (command.size > 1) {
val message = event.message.contentRaw.removePrefix("${prefix}setMessage").trim()
if (command.size > 2) {
val message = command.subList(2, command.size).toString().trim()
result.message = CustomMessage(message)
Channels.saveChannels()
event.message.channel.sendMessage("Set `$message` as message.").queue()
} else {
event.message.channel.sendMessage("Usage: `${prefix}setMessage [message]`")
event.message.channel.sendMessage("Usage: `${prefix}setMessage [type] [message]`")
}
} else {
event.message.channel.sendMessage("Channel is not registered.").queue()
}
}
"resetMessage" -> {
val result = Channels.channels.find { it.id == channelId }
if (msgType == MessageType.INVALID) {
event.message.channel.sendMessage("Please choose a valid category. List valid categories with ${prefix}categories").queue()
}
val result = Channels.channels.find { it.id == channelId && it.type == msgType }
if (result != null) {
result.message = null
Channels.saveChannels()
@@ -132,16 +175,19 @@ class OwnerCli : ListenerAdapter() {
}
"publishMessage" -> {
val result = Channels.channels.find { it.id == channelId }
if (msgType == MessageType.INVALID) {
event.message.channel.sendMessage("Please choose a valid category. List valid categories with ${prefix}categories").queue()
}
val result = Channels.channels.find { it.id == channelId && it.type == msgType }
if (result != null) {
if (result.message != null) {
if (command.size > 1 && listOf("on", "off").contains(command[1])) {
result.message?.pushAnnouncement = command[1] == "on"
if (command.size > 2 && listOf("on", "off").contains(command[2])) {
result.message?.pushAnnouncement = command[2] == "on"
Channels.saveChannels()
event.message.channel.sendMessage("Auto publish (message) is now ${command[1]}").queue()
} else {
event.message.channel.sendMessage("Usage: `${prefix}publishMessage [on|off]`")
event.message.channel.sendMessage("Usage: `${prefix}publishMessage [type] [on|off]`")
}
} else {
event.message.channel.sendMessage("Channel has no custom message.").queue()
@@ -185,22 +231,24 @@ class OwnerCli : ListenerAdapter() {
.setAuthor(Admin.admin?.name, Admin.admin?.avatarUrl, Admin.admin?.avatarUrl)
.setDescription(
"""
**${prefix}add**
**${prefix}add [type]**
Add this channel to the notified list
**${prefix}serviceChannel [add|remove]**
Add or remove this channel to receive service message from the bot developer (recommended)
**${prefix}remove**
**${prefix}remove [type]**
Remove this channel to the notified list
**${prefix}publish [on|off]**
**${prefix}publish [type] [on|off]**
[Community|Partner|Verified only] Auto publish the message if in an announcement channel
**${prefix}ping [none|everyone|roleName]**
**${prefix}ping [type] [none|everyone|roleName]**
What role to ping
**${prefix}setMessage [message]**
**${prefix}setMessage [type] [message]**
Set a custom message to show
**${prefix}resetMessage**
**${prefix}resetMessag [type]e**
Reset the message
**${prefix}info**
Show an overview about all channels registered on this server
**${prefix}categories**
Show a list of categories available for alert types
**${prefix}report**
Report an issue to the Bot Admin (this will share your user name so they can contact you)
**${prefix}help**

View File

@@ -0,0 +1,17 @@
package org.hmcore.serialization
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import org.hmcore.MessageType
import org.junit.Test
import kotlin.test.assertNotNull
class EnumTest {
@Test
fun `Enum serialization`() {
println(Json.encodeToString(MessageType.BLOGPOST))
assertNotNull(MessageType.INVALID)
}
}