19 lines
629 B
Kotlin
19 lines
629 B
Kotlin
package nl.voidcorp.dbot.commands
|
|
|
|
import net.dv8tion.jda.core.MessageBuilder
|
|
import java.time.temporal.ChronoUnit
|
|
|
|
|
|
val helloCommand = UnityCommand("hello", "Say hello to Andy!", aliases = *arrayOf()) {
|
|
it.reply(MessageBuilder("Hello, ").append(it.author).append("!").build())
|
|
}
|
|
|
|
|
|
val pingCommand = UnityCommand("ping", help = "Check the bot's ping", aliases = *arrayOf("pong")) { event ->
|
|
event.reply("Ping: ...") { m ->
|
|
val ping = event.message.creationTime.until(m.creationTime, ChronoUnit.MILLIS)
|
|
m.editMessage("Ping: " + ping + "ms | Websocket: " + event.getJDA().getPing() + "ms").queue()
|
|
}
|
|
}
|
|
|