me.jakejmattson.kutils.api.extensions.jda.MessageExtensions.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of KUtils Show documentation
Show all versions of KUtils Show documentation
A Discord bot framework for Kotlin.
@file:Suppress("unused")
package me.jakejmattson.kutils.api.extensions.jda
import me.jakejmattson.kutils.api.extensions.stdlib.*
import net.dv8tion.jda.api.entities.Message
fun Message.containsInvite() = contentRaw.containsInvite()
fun Message.containsURL() = contentRaw.containsURl()
fun Message.deleteIfExists(runnable: () -> Unit = {}) = channel.retrieveMessageById(id).queue { it?.delete()?.queue { runnable() } }
fun Message.mentionsSomeone() = (mentionsEveryone() || mentionedUsers.size > 0 || mentionedRoles.size > 0)
fun Message.isImagePost() =
if (attachments.isNotEmpty()) {
attachments.first().isImage && contentRaw.isBlank()
} else {
false
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy