feat: URL and URI converter
This commit is contained in:
parent
2e3c3cdd66
commit
fc9c4ff84a
9 changed files with 92 additions and 13 deletions
|
@ -2,6 +2,7 @@ package io.github.null2264.tsukumogami.bot.core.module
|
|||
|
||||
import dev.kord.core.entity.effectiveName
|
||||
import io.github.null2264.tsukumogami.bot.core.module.arguments.Test2Arguments
|
||||
import io.github.null2264.tsukumogami.bot.core.module.arguments.Test3Arguments
|
||||
import io.github.null2264.tsukumogami.bot.core.module.arguments.TestArguments
|
||||
import io.github.null2264.tsukumogami.core.module.api.botModules
|
||||
import kotlinx.datetime.Clock
|
||||
|
@ -17,9 +18,8 @@ val generalModule = botModules("General") {
|
|||
groups("group") {
|
||||
commands("test", arguments = ::Test2Arguments) { ctx, args -> ctx.reply("Hello world ${args.user}") }
|
||||
groups("group") {
|
||||
commands("test", alias = setOf("t")) { ctx ->
|
||||
ctx.reply("Hello world ${ctx.command?.module?.name}")
|
||||
ctx.reply("Bot: ${ctx.bot.self().effectiveName}")
|
||||
commands("test", alias = setOf("t"), arguments = ::Test3Arguments) { ctx, args ->
|
||||
ctx.reply("URL: ${args.url}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package io.github.null2264.tsukumogami.bot.core.module.arguments
|
|||
|
||||
import io.github.null2264.tsukumogami.core.commands.Arguments
|
||||
import io.github.null2264.tsukumogami.core.commands.ext.string
|
||||
import io.github.null2264.tsukumogami.core.commands.ext.url
|
||||
import io.github.null2264.tsukumogami.core.commands.ext.user
|
||||
|
||||
class TestArguments : Arguments() {
|
||||
|
@ -15,3 +16,6 @@ class TestArguments : Arguments() {
|
|||
class Test2Arguments : Arguments() {
|
||||
val user by user("User")
|
||||
}
|
||||
class Test3Arguments : Arguments() {
|
||||
val url by url("Link")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue