mirror of
https://github.com/jie65535/JDice.git
synced 2025-12-15 19:07:34 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 907a30b654 | |||
| 52b61d41d1 | |||
| 0975e7e49c | |||
| f631218c0c |
@@ -5,4 +5,4 @@
|
|||||||
|
|
||||||
`d20` 表示投出`1`颗`20`面骰子。
|
`d20` 表示投出`1`颗`20`面骰子。
|
||||||
|
|
||||||
匹配的正则表达式如下`(\d*)[dD](\d+)`
|
匹配的正则表达式如下`\b(\d*)[dD](\d+)\b`
|
||||||
@@ -7,7 +7,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "top.jie65535"
|
group = "top.jie65535"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven("https://maven.aliyun.com/repository/public")
|
maven("https://maven.aliyun.com/repository/public")
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ object JDice : KotlinPlugin(
|
|||||||
JvmPluginDescription(
|
JvmPluginDescription(
|
||||||
id = "top.jie65535.dice",
|
id = "top.jie65535.dice",
|
||||||
name = "J Dice",
|
name = "J Dice",
|
||||||
version = "0.1.0",
|
version = "0.1.1",
|
||||||
) {
|
) {
|
||||||
author("jie65535")
|
author("jie65535")
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
private val regex = Regex("""(\d*)[dD](\d+)""")
|
private val regex = Regex("""\b(\d*)[dD](\d+)\b""")
|
||||||
private val random = Random(System.currentTimeMillis())
|
private val random = Random(System.currentTimeMillis())
|
||||||
|
|
||||||
override fun onEnable() {
|
override fun onEnable() {
|
||||||
@@ -28,7 +28,7 @@ object JDice : KotlinPlugin(
|
|||||||
val count = if (c.isEmpty()) 1 else c.toInt()
|
val count = if (c.isEmpty()) 1 else c.toInt()
|
||||||
val top = d.toInt()
|
val top = d.toInt()
|
||||||
if (count > 0 && top > 1) {
|
if (count > 0 && top > 1) {
|
||||||
val value = random.nextInt(count, count * top) + 1
|
val value = random.nextInt(count, count * top + 1)
|
||||||
subject.sendMessage(message.quote() + value.toString())
|
subject.sendMessage(message.quote() + value.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,4 +36,4 @@ object JDice : KotlinPlugin(
|
|||||||
|
|
||||||
logger.info { "Plugin loaded. https://github.com/jie65535/JDice" }
|
logger.info { "Plugin loaded. https://github.com/jie65535/JDice" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user