chore: bump rob
This commit is contained in:
118 files changed
+208
-303
No files matched your search
@@ -57,7 +57,7 @@ object Http {
|
||||
fun get(
|
||||
url: String,
|
||||
params: Map<String, Any>? = null,
|
||||
headers: Map<String, String>? = null
|
||||
headers: Map<String, String>? = null,
|
||||
): String {
|
||||
val paramsUrl = buildParams(url, params)
|
||||
val request = Request.Builder()
|
||||
@@ -71,7 +71,7 @@ object Http {
|
||||
inline fun <reified T> get(
|
||||
url: String,
|
||||
params: Map<String, Any>? = null,
|
||||
headers: Map<String, String>? = null
|
||||
headers: Map<String, String>? = null,
|
||||
): T {
|
||||
return get(url, params, headers).fromJson<T>()
|
||||
}
|
||||
@@ -81,7 +81,7 @@ object Http {
|
||||
url: String,
|
||||
formBody: Map<String, Any>? = null,
|
||||
headers: Map<String, String>? = null,
|
||||
params: Map<String, Any>? = null
|
||||
params: Map<String, Any>? = null,
|
||||
): T {
|
||||
val body = FormBody.Builder()
|
||||
val paramsUrl = buildParams(url, params)
|
||||
@@ -102,7 +102,7 @@ object Http {
|
||||
url: String,
|
||||
jsonBody: String,
|
||||
headers: Map<String, String>? = null,
|
||||
params: Map<String, Any>? = null
|
||||
params: Map<String, Any>? = null,
|
||||
): T {
|
||||
val result = post(url, jsonBody, headers, params)
|
||||
return result.fromJson<T>()
|
||||
@@ -113,7 +113,7 @@ object Http {
|
||||
url: String,
|
||||
jsonBody: String,
|
||||
headers: Map<String, String>? = null,
|
||||
params: Map<String, Any>? = null
|
||||
params: Map<String, Any>? = null,
|
||||
): String {
|
||||
val body = jsonBody.toRequestBody(jsonMediaType)
|
||||
val paramsUrl = buildParams(url, params)
|
||||
@@ -129,7 +129,7 @@ object Http {
|
||||
inline fun <reified T> post(
|
||||
url: String,
|
||||
form: FormBody,
|
||||
headers: Map<String, String>? = null
|
||||
headers: Map<String, String>? = null,
|
||||
): T {
|
||||
val request = Request.Builder()
|
||||
.post(form)
|
||||
@@ -142,7 +142,7 @@ object Http {
|
||||
inline fun <reified T> post(
|
||||
url: String,
|
||||
form: MultipartBody,
|
||||
headers: Map<String, String>? = null
|
||||
headers: Map<String, String>? = null,
|
||||
): T {
|
||||
val request = Request.Builder()
|
||||
.post(form)
|
||||
@@ -155,7 +155,7 @@ object Http {
|
||||
url: String,
|
||||
jsonBody: String,
|
||||
headers: Map<String, String>? = null,
|
||||
params: Map<String, Any>? = null
|
||||
params: Map<String, Any>? = null,
|
||||
): T {
|
||||
val paramsUrl = buildParams(url, params)
|
||||
val request = Request.Builder()
|
||||
@@ -169,7 +169,7 @@ object Http {
|
||||
url: String,
|
||||
jsonBody: String,
|
||||
headers: Map<String, String>? = null,
|
||||
params: Map<String, Any>? = null
|
||||
params: Map<String, Any>? = null,
|
||||
): String {
|
||||
val paramsUrl = buildParams(url, params)
|
||||
val request = Request.Builder()
|
||||
|
||||
@@ -9,15 +9,13 @@ package cn.rtast.fancybot.util.item
|
||||
|
||||
import cn.rtast.rob.entity.GroupMessage
|
||||
import cn.rtast.rob.util.ob.MessageChain
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
|
||||
abstract class Item {
|
||||
abstract val itemNames: List<String>
|
||||
abstract val itemPrice: Double
|
||||
|
||||
abstract suspend fun redeemInGroup(
|
||||
listener: OneBotListener,
|
||||
message: GroupMessage,
|
||||
after: Double
|
||||
after: Double,
|
||||
): MessageChain.Builder
|
||||
}
|
||||
@@ -42,7 +42,7 @@ import kotlin.random.Random
|
||||
class MCClient(
|
||||
private val serverHost: String,
|
||||
private val serverPort: Int,
|
||||
private val botName: String
|
||||
private val botName: String,
|
||||
) {
|
||||
private lateinit var client: TcpClientSession
|
||||
private val logger = Logger.getLogger<MCClient>()
|
||||
|
||||
@@ -35,7 +35,7 @@ fun Graphics2D.drawCustomImage(
|
||||
y: Int,
|
||||
maxWidth: Double,
|
||||
maxHeight: Double,
|
||||
clip: Boolean = false
|
||||
clip: Boolean = false,
|
||||
) {
|
||||
val (targetWidth, targetHeight) = image.getScaledWidth(maxWidth, maxHeight)
|
||||
if (clip) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import cn.rtast.fancybot.util.Http
|
||||
import cn.rtast.rob.BotInstance
|
||||
import cn.rtast.rob.ROneBotFactory
|
||||
import cn.rtast.rob.util.ob.OneBotAction
|
||||
import cn.rtast.rob.util.ob.OneBotListener
|
||||
import java.io.File
|
||||
import kotlin.random.Random
|
||||
import kotlin.time.Duration.Companion.hours
|
||||
@@ -23,8 +22,8 @@ fun randomBooleanWithProbability(probability: Double): Boolean {
|
||||
return randomValue <= (probability * 100)
|
||||
}
|
||||
|
||||
suspend fun OneBotListener.getUserName(action: OneBotAction, groupId: Long, userId: Long): String {
|
||||
val info = action.getGroupMemberInfo(groupId, userId)
|
||||
suspend fun OneBotAction.getUserName(groupId: Long, userId: Long): String {
|
||||
val info = this.getGroupMemberInfo(groupId, userId)
|
||||
return info.card ?: info.nickname
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user