18 lines
730 B
Kotlin
18 lines
730 B
Kotlin
package nl.voidcorp.discord.commands.`fun`
|
|
|
|
import nl.voidcorp.discord.command.Command
|
|
import nl.voidcorp.discord.command.CommandGroup
|
|
import nl.voidcorp.discord.command.CommandMessage
|
|
import nl.voidcorp.discord.command.CommandResult
|
|
import org.springframework.stereotype.Service
|
|
import java.net.URI
|
|
|
|
@Service
|
|
class DogCommand : Command("dog", group = CommandGroup.FUN, allowAnywhere = true) {
|
|
override fun handle(event: CommandMessage): CommandResult {
|
|
val image = URI.create("https://random.dog/woof").toURL().readText()
|
|
val url = URI("https://random.dog/$image").toURL().openStream()
|
|
event.message.channel.sendFile(url, image).content("i is dog").queue()
|
|
return CommandResult.SUCCESS
|
|
}
|
|
} |