Compare commits

..

No commits in common. "fc65e875e201ba3916e9c7f66ce5e10ae9b4b568" and "90307e1ee92c50c125dbf1f430d61ccd1658be48" have entirely different histories.

14 changed files with 5 additions and 314 deletions

View File

@ -1,12 +0,0 @@
{
"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"
}
}

View File

@ -1,17 +0,0 @@
{
"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
}

30
pom.xml
View File

@ -77,6 +77,10 @@
<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>
@ -106,29 +110,6 @@
<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>
@ -138,9 +119,6 @@
<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>

View File

@ -1,19 +1,11 @@
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)
} }

View File

@ -60,7 +60,7 @@ class BotConfiguration {
private fun BotConfiguration.extracted() { private fun BotConfiguration.extracted() {
fileBasedDeviceInfo() fileBasedDeviceInfo()
protocol = BotConfiguration.MiraiProtocol.ANDROID_PAD protocol = BotConfiguration.MiraiProtocol.MACOS
enableContactCache() enableContactCache()
} }
} }

View File

@ -1,68 +0,0 @@
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")
}
}

View File

@ -1,73 +0,0 @@
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")
}
}

View File

@ -1,18 +0,0 @@
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
}
}

View File

@ -1,12 +0,0 @@
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> {
}

View File

@ -1,49 +0,0 @@
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("定时喝水提醒服务 - 结束")
}
}

View File

@ -1,17 +1,2 @@
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

View File

@ -1,14 +0,0 @@
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

View File

@ -8,4 +8,3 @@ bot:
admin: 1075576561 admin: 1075576561
server: server:
port: 25684 # 无用随机端口 port: 25684 # 无用随机端口