Compare commits
2 Commits
90307e1ee9
...
fc65e875e2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
fc65e875e2 | ||
![]() |
6b18dd55a7 |
12
KFCFactory.json
Normal file
12
KFCFactory.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"9.0.56": {
|
||||||
|
"base_url": "https://qsign.trpgbot.com",
|
||||||
|
"type": "fuqiuluo/unidbg-fetch-qsign",
|
||||||
|
"key": "114514"
|
||||||
|
},
|
||||||
|
"9.0.95": {
|
||||||
|
"base_url": "https://qsign.trpgbot.com",
|
||||||
|
"type": "fuqiuluo/unidbg-fetch-qsign",
|
||||||
|
"key": "114514"
|
||||||
|
}
|
||||||
|
}
|
17
android_pad.json
Normal file
17
android_pad.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"apk_id": "com.tencent.mobileqq",
|
||||||
|
"app_id": 537220362,
|
||||||
|
"sub_app_id": 537220362,
|
||||||
|
"app_key": "0S200MNJT807V3GE",
|
||||||
|
"sort_version_name": "9.0.56.16830",
|
||||||
|
"build_time": 1713424357,
|
||||||
|
"apk_sign": "a6b745bf24a2c277527716f6f36eb68d",
|
||||||
|
"sdk_version": "6.0.0.2560",
|
||||||
|
"sso_version": 21,
|
||||||
|
"misc_bitmap": 150470524,
|
||||||
|
"main_sig_map": 34869472,
|
||||||
|
"sub_sig_map": 66560,
|
||||||
|
"dump_time": 1713424357,
|
||||||
|
"qua": "V1_AND_SQ_9.0.56_6372_YYB_D",
|
||||||
|
"protocol_type": 6
|
||||||
|
}
|
BIN
lib/fix-protocol-version-1.13.0.mirai2.jar
Normal file
BIN
lib/fix-protocol-version-1.13.0.mirai2.jar
Normal file
Binary file not shown.
30
pom.xml
30
pom.xml
@ -77,10 +77,6 @@
|
|||||||
<groupId>org.jetbrains.kotlinx</groupId>
|
<groupId>org.jetbrains.kotlinx</groupId>
|
||||||
<artifactId>kotlinx-coroutines-reactor</artifactId>
|
<artifactId>kotlinx-coroutines-reactor</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId></groupId>-->
|
|
||||||
<!-- <artifactId></artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.mysql</groupId>
|
<groupId>com.mysql</groupId>
|
||||||
@ -110,6 +106,29 @@
|
|||||||
<artifactId>hutool-http</artifactId>
|
<artifactId>hutool-http</artifactId>
|
||||||
<version>5.8.27</version>
|
<version>5.8.27</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||||
|
<version>3.5.7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/org.asynchttpclient/async-http-client -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.asynchttpclient</groupId>
|
||||||
|
<artifactId>async-http-client</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>xyz.cssxsh.mirai</groupId>
|
||||||
|
<artifactId>fix-protocol</artifactId>
|
||||||
|
<version>3.3.1</version>
|
||||||
|
<scope>system</scope>
|
||||||
|
<systemPath>${project.basedir}/lib/fix-protocol-version-1.13.0.mirai2.jar</systemPath>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -119,6 +138,9 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<includeSystemScope>true</includeSystemScope>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
package info.alinadace.miraibot
|
package info.alinadace.miraibot
|
||||||
|
|
||||||
|
import net.mamoe.mirai.utils.BotConfiguration
|
||||||
|
import org.mybatis.spring.annotation.MapperScan
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||||
import org.springframework.boot.runApplication
|
import org.springframework.boot.runApplication
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling
|
||||||
|
import xyz.cssxsh.mirai.tool.FixProtocolVersion
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
|
@MapperScan("info.alinadace.miraibot.service")
|
||||||
class MiraiBotApplication
|
class MiraiBotApplication
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
// FixProtocolVersion.fetch(BotConfiguration.MiraiProtocol.ANDROID_PHONE, "8.9.96")
|
||||||
|
FixProtocolVersion.load(BotConfiguration.MiraiProtocol.ANDROID_PAD)
|
||||||
runApplication<MiraiBotApplication>(*args)
|
runApplication<MiraiBotApplication>(*args)
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class BotConfiguration {
|
|||||||
|
|
||||||
private fun BotConfiguration.extracted() {
|
private fun BotConfiguration.extracted() {
|
||||||
fileBasedDeviceInfo()
|
fileBasedDeviceInfo()
|
||||||
protocol = BotConfiguration.MiraiProtocol.MACOS
|
protocol = BotConfiguration.MiraiProtocol.ANDROID_PAD
|
||||||
enableContactCache()
|
enableContactCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package info.alinadace.miraibot.service.drink_water
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
|
||||||
|
import info.alinadace.miraibot.annotation.BotFunction
|
||||||
|
import info.alinadace.miraibot.service.Service
|
||||||
|
import info.alinadace.miraibot.service.drink_water.domain.DrinkWaterUser
|
||||||
|
import info.alinadace.miraibot.service.drink_water.mapper.DrinkWaterMapper
|
||||||
|
import jakarta.annotation.Resource
|
||||||
|
import net.mamoe.mirai.event.events.FriendMessageEvent
|
||||||
|
import net.mamoe.mirai.message.data.MessageSource
|
||||||
|
import net.mamoe.mirai.message.data.PlainText
|
||||||
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时喝水提醒关闭服务
|
||||||
|
* @author Kane
|
||||||
|
* @since 2024/9/18 13:27
|
||||||
|
*/
|
||||||
|
@BotFunction(FriendMessageEvent::class)
|
||||||
|
class DisableService : Service<FriendMessageEvent> {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val log: Logger = LoggerFactory.getLogger(this::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
lateinit var drinkWaterMapper: DrinkWaterMapper
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务入口
|
||||||
|
*/
|
||||||
|
override fun entrance(event: FriendMessageEvent): Boolean {
|
||||||
|
val chain = event.message
|
||||||
|
val filter = chain.filter { it !is MessageSource }
|
||||||
|
if (filter.size == 1 && filter[0] is PlainText) {
|
||||||
|
if (filter[0].contentToString() == "关闭喝水提醒") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务行为
|
||||||
|
*/
|
||||||
|
override suspend fun active(event: FriendMessageEvent) {
|
||||||
|
log.info("服务关闭请求 - DrinkWater - target:{}", event.sender.id)
|
||||||
|
val one = drinkWaterMapper.selectOne(
|
||||||
|
KtQueryWrapper(DrinkWaterUser())
|
||||||
|
.eq(DrinkWaterUser::botId, event.sender.id)
|
||||||
|
)
|
||||||
|
if (one == null) {
|
||||||
|
event.subject.sendMessage("服务已关闭 - DrinkWater")
|
||||||
|
log.info("服务已关闭 - DrinkWater - target:{} - 无记录", event.sender.id)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (one.enable == DrinkWaterUser.ENABLE) {
|
||||||
|
one.enable = DrinkWaterUser.DISABLE
|
||||||
|
val updateById = drinkWaterMapper.updateById(one)
|
||||||
|
event.subject.sendMessage("服务已关闭 - DrinkWater")
|
||||||
|
log.info("服务已关闭 - DrinkWater - target:{} - 记录更新 - {}", event.sender.id, updateById)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
event.subject.sendMessage("服务已关闭 - DrinkWater")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package info.alinadace.miraibot.service.drink_water
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
|
||||||
|
import info.alinadace.miraibot.annotation.BotFunction
|
||||||
|
import info.alinadace.miraibot.service.Service
|
||||||
|
import info.alinadace.miraibot.service.drink_water.domain.DrinkWaterUser
|
||||||
|
import info.alinadace.miraibot.service.drink_water.mapper.DrinkWaterMapper
|
||||||
|
import jakarta.annotation.Resource
|
||||||
|
import net.mamoe.mirai.event.events.FriendMessageEvent
|
||||||
|
import net.mamoe.mirai.message.data.MessageSource
|
||||||
|
import net.mamoe.mirai.message.data.PlainText
|
||||||
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时喝水提醒开启服务
|
||||||
|
* @author Kane
|
||||||
|
* @since 2024/9/18 13:27
|
||||||
|
*/
|
||||||
|
@BotFunction(FriendMessageEvent::class)
|
||||||
|
class EnableService : Service<FriendMessageEvent> {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val log: Logger = LoggerFactory.getLogger(this::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
lateinit var drinkWaterMapper: DrinkWaterMapper
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务入口
|
||||||
|
*/
|
||||||
|
override fun entrance(event: FriendMessageEvent): Boolean {
|
||||||
|
val chain = event.message
|
||||||
|
val filter = chain.filter { it !is MessageSource }
|
||||||
|
if (filter.size == 1 && filter[0] is PlainText) {
|
||||||
|
if (filter[0].contentToString() == "开启喝水提醒") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务行为
|
||||||
|
*/
|
||||||
|
override suspend fun active(event: FriendMessageEvent) {
|
||||||
|
log.info("服务开启请求 - DrinkWater - target:{}", event.sender.id)
|
||||||
|
val one = drinkWaterMapper.selectOne(
|
||||||
|
KtQueryWrapper(DrinkWaterUser())
|
||||||
|
.eq(DrinkWaterUser::botId, event.sender.id)
|
||||||
|
)
|
||||||
|
if (one == null) {
|
||||||
|
val let = DrinkWaterUser().apply {
|
||||||
|
botId = event.sender.id
|
||||||
|
enable = DrinkWaterUser.ENABLE
|
||||||
|
}.let {
|
||||||
|
drinkWaterMapper.insert(it)
|
||||||
|
}
|
||||||
|
event.subject.sendMessage("服务已开启 - DrinkWater")
|
||||||
|
log.info("服务开启请求 - DrinkWater - target:{} - 记录创建 - {}", event.sender.id, let)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (one.enable == DrinkWaterUser.DISABLE) {
|
||||||
|
one.enable = DrinkWaterUser.ENABLE
|
||||||
|
val updateById = drinkWaterMapper.updateById(one)
|
||||||
|
event.subject.sendMessage("服务已开启 - DrinkWater")
|
||||||
|
log.info("服务开启请求 - DrinkWater - target:{} - 记录更新 - {}", event.sender.id, updateById)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
event.subject.sendMessage("服务已开启 - DrinkWater")
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package info.alinadace.miraibot.service.drink_water.domain
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 喝水提醒用户
|
||||||
|
*/
|
||||||
|
class DrinkWaterUser {
|
||||||
|
@TableId
|
||||||
|
var id: Long? = null
|
||||||
|
var botId: Long? = null
|
||||||
|
var enable: Byte? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val ENABLE: Byte = 1
|
||||||
|
const val DISABLE: Byte = 0
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package info.alinadace.miraibot.service.drink_water.mapper
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper
|
||||||
|
import info.alinadace.miraibot.service.drink_water.domain.DrinkWaterUser
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 喝水提醒用户Mapper
|
||||||
|
* @author Kane
|
||||||
|
* @since 2024/9/18 13:39
|
||||||
|
*/
|
||||||
|
interface DrinkWaterMapper : BaseMapper<DrinkWaterUser> {
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package info.alinadace.miraibot.service.drink_water.task
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.kotlin.KtQueryWrapper
|
||||||
|
import info.alinadace.miraibot.service.drink_water.domain.DrinkWaterUser
|
||||||
|
import info.alinadace.miraibot.service.drink_water.mapper.DrinkWaterMapper
|
||||||
|
import jakarta.annotation.Resource
|
||||||
|
import net.mamoe.mirai.Bot
|
||||||
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时喝水提醒服务
|
||||||
|
* @author Kane
|
||||||
|
* @since 2024/9/18 13:59
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
class ReminderService {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val log: Logger = LoggerFactory.getLogger(this::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
lateinit var bot: Bot
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
lateinit var drinkWaterMapper: DrinkWaterMapper
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0 0,8-23/2 * * *")
|
||||||
|
suspend fun reminder() {
|
||||||
|
log.info("定时喝水提醒服务 - 开始")
|
||||||
|
val list = drinkWaterMapper.selectList(
|
||||||
|
KtQueryWrapper(DrinkWaterUser())
|
||||||
|
.eq(DrinkWaterUser::enable, DrinkWaterUser.ENABLE)
|
||||||
|
)
|
||||||
|
log.info("定时喝水提醒服务 - 查询结果 - {}", list)
|
||||||
|
list.forEach {
|
||||||
|
if (it.botId == null || it.botId == 0L) {
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
bot.getFriend(it.botId!!)?.sendMessage("请喝水")
|
||||||
|
log.info("定时喝水提醒服务 - 发送消息 - {}", it.botId)
|
||||||
|
}
|
||||||
|
log.info("定时喝水提醒服务 - 结束")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,2 +1,17 @@
|
|||||||
bot:
|
bot:
|
||||||
id: 3437522130
|
id: 3437522130
|
||||||
|
type: password
|
||||||
|
password: nobuts001
|
||||||
|
spring:
|
||||||
|
data:
|
||||||
|
redis:
|
||||||
|
host: 101.35.164.171
|
||||||
|
password: wTE32JjsieQ2JTOwsg9X
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://localhost:3306/mirai?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||||
|
username: root
|
||||||
|
password: nobuts001
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
bot:
|
||||||
|
id: 3437522130
|
||||||
|
type: password
|
||||||
|
password: nobuts001
|
||||||
|
spring:
|
||||||
|
data:
|
||||||
|
redis:
|
||||||
|
host: 10.0.4.16
|
||||||
|
password: wTE32JjsieQ2JTOwsg9X
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://10.0.4.16:3306/mirai?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||||
|
username: root
|
||||||
|
password: FydsaZsFm5w26We6
|
@ -8,3 +8,4 @@ bot:
|
|||||||
admin: 1075576561
|
admin: 1075576561
|
||||||
server:
|
server:
|
||||||
port: 25684 # 无用随机端口
|
port: 25684 # 无用随机端口
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user