Skip to content

Commit

Permalink
骰子添加限制
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyv404 committed Nov 19, 2023
1 parent 5f09532 commit a8ab415
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/kotlin/com/xiaoyv404/mirai/app/dice/Listener.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.xiaoyv404.mirai.app.fsh.IFshApp
import com.xiaoyv404.mirai.core.App
import com.xiaoyv404.mirai.core.MessageProcessor.reply
import com.xiaoyv404.mirai.core.NfApp
import com.xiaoyv404.mirai.dao.authorityIdentification
import net.mamoe.mirai.event.events.MessageEvent

@App
Expand All @@ -12,8 +13,13 @@ class Dice : NfApp(), IFshApp {
override fun getVersion() = "1.0.1"
override fun getAppDescription() = "骰子"
override fun getCommands() = arrayOf(".r")
override fun getLimitCount() = 1
override fun getLimitExpiresTime() = 180L
override fun getLimitHint() = false

override suspend fun executeRsh(args: Array<String>, msg: MessageEvent): Boolean {
if (msg.authorityIdentification(getAppName()))
return false
val rd = args.getOrNull(1)?.let { Regex("^((\\d+)((\\((\\d+)\\))|(:(\\d+)))?)\$").find(it) }?.groups

val start = rd?.get(2)?.value?.toLong() ?: 1L
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/com/xiaoyv404/mirai/model/Group.dao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ data class Notice(

@Suppress("PropertyName")
data class Permissions(
val Dice: Permission,
val DebuMe: Permission,
val NetworkEro: Permission,
val LocalGallery: Permission,
Expand Down

0 comments on commit a8ab415

Please sign in to comment.