Compare commits
24 Commits
drink-wate
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e7ad348544 | ||
![]() |
7cedd4e152 | ||
![]() |
7d36b6d9dc | ||
![]() |
84c2a7d82d | ||
![]() |
787520c98b | ||
![]() |
f818241731 | ||
![]() |
10ed0dc703 | ||
![]() |
f4475cd09d | ||
![]() |
3aadf53e0e | ||
![]() |
a7fcb58f98 | ||
![]() |
80a782f41d | ||
![]() |
2fed165aba | ||
![]() |
67ac79e17f | ||
![]() |
791fee74d4 | ||
![]() |
3b3d5b6fa6 | ||
![]() |
4b3deaa520 | ||
![]() |
45f79398fd | ||
![]() |
24179727ed | ||
![]() |
27755a6d7b | ||
![]() |
47fbae8703 | ||
![]() |
a941c05a75 | ||
![]() |
8f532c5686 | ||
![]() |
f81ddde881 | ||
![]() |
ee6403eb7d |
@ -1,19 +1,18 @@
|
|||||||
name: Gitea Actions Demo
|
name: Mirai-build
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||||
on: [ push ]
|
on: [ push ]
|
||||||
|
env:
|
||||||
|
BARE_REPO_DIR: https://git.alina-dace.info/Dace/Mirai-bot.git
|
||||||
|
CLONED_REPO_DIR: ./
|
||||||
jobs:
|
jobs:
|
||||||
Explore-Gitea-Actions:
|
Explore-Gitea-Actions:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
- run: |
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
rm -rf ./*
|
||||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
git clone $BARE_REPO_DIR $CLONED_REPO_DIR
|
||||||
- name: Check out repository code
|
- run: pwd
|
||||||
uses: actions/checkout@v4
|
# - run: ls -sl
|
||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
# - run: chmod +x ./mvnw
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
- run: docker run -it --rm --name my-maven-project -v "$(pwd)":/usr/src/mymaven -v maven-repo:/root/.m2 -w /usr/src/mymaven maven mvn -DskipTests=true clean package -P prod-remote
|
||||||
- name: List files in the repository
|
- run: docker build -t mirai-bot:latest
|
||||||
run: |
|
|
||||||
ls ${{ gitea.workspace }}
|
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
|
||||||
|
4
.mvn/wrapper/maven-wrapper.properties
vendored
4
.mvn/wrapper/maven-wrapper.properties
vendored
@ -6,7 +6,7 @@
|
|||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
@ -16,4 +16,4 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
wrapperVersion=3.3.2
|
wrapperVersion=3.3.2
|
||||||
distributionType=only-script
|
distributionType=only-script
|
||||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip
|
distributionUrl=https://mirrors.huaweicloud.com/repository/maven//org/apache/maven/apache-maven/3.9.7/apache-maven-3.9.7-bin.zip
|
||||||
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#FROM maven as builder
|
||||||
|
#WORKDIR /app
|
||||||
|
#COPY . .
|
||||||
|
#RUN mvn clean package
|
||||||
|
|
||||||
|
FROM bellsoft/liberica-openjdk-debian:17.0.11-cds
|
||||||
|
LABEL authors="Kane"
|
||||||
|
|
||||||
|
WORKDIR /opt
|
||||||
|
#COPY --from=builder /app/target/Mirai-bot-0.0.1-SNAPSHOT.jar /opt/Mirai-bot.jar
|
||||||
|
COPY target/Mirai-bot-0.0.1-SNAPSHOT.jar /opt/Mirai-bot.jar
|
||||||
|
ENTRYPOINT java -jar /opt/Mirai-bot.jar
|
||||||
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
@ -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
|
|
||||||
}
|
|
2
mvnw
vendored
2
mvnw
vendored
@ -8,7 +8,7 @@
|
|||||||
# "License"); you may not use this file except in compliance
|
# "License"); you may not use this file except in compliance
|
||||||
# with the License. You may obtain a copy of the License at
|
# with the License. You may obtain a copy of the License at
|
||||||
#
|
#
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
#
|
||||||
# Unless required by applicable law or agreed to in writing,
|
# Unless required by applicable law or agreed to in writing,
|
||||||
# software distributed under the License is distributed on an
|
# software distributed under the License is distributed on an
|
||||||
|
2
mvnw.cmd
vendored
2
mvnw.cmd
vendored
@ -8,7 +8,7 @@
|
|||||||
@REM "License"); you may not use this file except in compliance
|
@REM "License"); you may not use this file except in compliance
|
||||||
@REM with the License. You may obtain a copy of the License at
|
@REM with the License. You may obtain a copy of the License at
|
||||||
@REM
|
@REM
|
||||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||||
@REM
|
@REM
|
||||||
@REM Unless required by applicable law or agreed to in writing,
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
@REM software distributed under the License is distributed on an
|
@REM software distributed under the License is distributed on an
|
||||||
|
42
pom.xml
42
pom.xml
@ -42,11 +42,37 @@
|
|||||||
<profiles.active>prod</profiles.active>
|
<profiles.active>prod</profiles.active>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>prod-remote</id>
|
||||||
|
<properties>
|
||||||
|
<profiles.active>prod-remote</profiles.active>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
</profiles>
|
</profiles>
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<kotlin.version>1.9.25</kotlin.version>
|
<kotlin.version>1.9.25</kotlin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>HuaweiCloud</id>
|
||||||
|
<name>HuaweiCloud</name>
|
||||||
|
<url>https://mirrors.huaweicloud.com/repository/maven</url>
|
||||||
|
</repository>
|
||||||
|
<!-- Maven 官方仓库 -->
|
||||||
|
<repository>
|
||||||
|
<id>MavenOfficial</id>
|
||||||
|
<name>MavenOfficial</name>
|
||||||
|
<url>https://repo.maven.apache.org/maven2</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>HuaweiCloud</id>
|
||||||
|
<name>HuaweiCloud</name>
|
||||||
|
<url>https://mirrors.huaweicloud.com/repository/maven</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 运行依赖 -->
|
<!-- 运行依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -95,9 +121,16 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 核心 机器人 -->
|
<!-- 核心 机器人 -->
|
||||||
|
<!-- https://mvnrepository.com/artifact/top.mrxiaom.mirai/overflow-core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>top.mrxiaom.mirai</groupId>
|
||||||
|
<artifactId>overflow-core</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.mamoe</groupId>
|
<groupId>net.mamoe</groupId>
|
||||||
<artifactId>mirai-core-jvm</artifactId>
|
<artifactId>mirai-core-api-jvm</artifactId>
|
||||||
<version>2.16.0</version>
|
<version>2.16.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -122,13 +155,6 @@
|
|||||||
<artifactId>async-http-client</artifactId>
|
<artifactId>async-http-client</artifactId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</dependency>
|
</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>
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package info.alinadace.miraibot
|
package info.alinadace.miraibot
|
||||||
|
|
||||||
import net.mamoe.mirai.utils.BotConfiguration
|
|
||||||
import org.mybatis.spring.annotation.MapperScan
|
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 org.springframework.scheduling.annotation.EnableScheduling
|
||||||
import xyz.cssxsh.mirai.tool.FixProtocolVersion
|
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@ -13,7 +11,5 @@ import xyz.cssxsh.mirai.tool.FixProtocolVersion
|
|||||||
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)
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,14 @@ package info.alinadace.miraibot.bean
|
|||||||
|
|
||||||
import info.alinadace.miraibot.annotation.BotFunction
|
import info.alinadace.miraibot.annotation.BotFunction
|
||||||
import info.alinadace.miraibot.configuration.BotConfig
|
import info.alinadace.miraibot.configuration.BotConfig
|
||||||
import info.alinadace.miraibot.enums.LoginType
|
|
||||||
import info.alinadace.miraibot.service.Service
|
import info.alinadace.miraibot.service.Service
|
||||||
|
import kotlinx.coroutines.async
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import net.mamoe.mirai.Bot
|
import net.mamoe.mirai.Bot
|
||||||
import net.mamoe.mirai.BotFactory
|
|
||||||
import net.mamoe.mirai.auth.BotAuthorization
|
|
||||||
import net.mamoe.mirai.event.Event
|
import net.mamoe.mirai.event.Event
|
||||||
import net.mamoe.mirai.utils.BotConfiguration
|
|
||||||
import org.springframework.context.annotation.Bean
|
import org.springframework.context.annotation.Bean
|
||||||
import org.springframework.context.annotation.Configuration
|
import org.springframework.context.annotation.Configuration
|
||||||
|
import top.mrxiaom.overflow.BotBuilder
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,15 +22,13 @@ class BotConfiguration {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
fun bot(config: BotConfig): Bot {
|
fun bot(config: BotConfig): Bot {
|
||||||
return when (config.type) {
|
val connect = runBlocking {
|
||||||
LoginType.PASSWORD -> BotFactory.newBot(config.id, config.password) {
|
val bot = async {
|
||||||
extracted()
|
BotBuilder.positive(config.ws).token(config.token).connect() ?: throw Exception("Bot connect failed")
|
||||||
}
|
|
||||||
|
|
||||||
LoginType.QRCODE -> BotFactory.newBot(config.id, BotAuthorization.byQRCode()) {
|
|
||||||
extracted()
|
|
||||||
}
|
}
|
||||||
|
bot.await()
|
||||||
}
|
}
|
||||||
|
return connect
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean("functionMap")
|
@Bean("functionMap")
|
||||||
@ -57,10 +54,4 @@ class BotConfiguration {
|
|||||||
}
|
}
|
||||||
return eventMap
|
return eventMap
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun BotConfiguration.extracted() {
|
|
||||||
fileBasedDeviceInfo()
|
|
||||||
protocol = BotConfiguration.MiraiProtocol.ANDROID_PAD
|
|
||||||
enableContactCache()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -15,18 +15,31 @@ class BotConfig {
|
|||||||
/**
|
/**
|
||||||
* 机器人QQ号
|
* 机器人QQ号
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(message = "内部认证已失效")
|
||||||
final var id: Long = 0L
|
final var id: Long = 0L
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人密码
|
* 机器人密码
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(message = "内部认证已失效")
|
||||||
final var password: String = ""
|
final var password: String = ""
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机器人登录方式
|
* 机器人登录方式
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(message = "内部认证已失效")
|
||||||
final var type: LoginType = LoginType.PASSWORD
|
final var type: LoginType = LoginType.PASSWORD
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器人ws地址
|
||||||
|
*/
|
||||||
|
final var ws: String = ""
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机器人token
|
||||||
|
*/
|
||||||
|
final var token: String = ""
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理员QQ
|
* 管理员QQ
|
||||||
*/
|
*/
|
||||||
@ -34,10 +47,13 @@ class BotConfig {
|
|||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
|
|
||||||
constructor(id: Long, password: String, type: LoginType, admin: Long) {
|
constructor(id: Long, password: String, type: LoginType, ws: String, token: String, admin: Long) {
|
||||||
this.id = id
|
this.id = id
|
||||||
this.password = password
|
this.password = password
|
||||||
this.type = type
|
this.type = type
|
||||||
|
this.ws = ws
|
||||||
|
this.token = token
|
||||||
this.admin = admin
|
this.admin = admin
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,4 @@ import info.alinadace.miraibot.service.drink_water.domain.DrinkWaterUser
|
|||||||
* @author Kane
|
* @author Kane
|
||||||
* @since 2024/9/18 13:39
|
* @since 2024/9/18 13:39
|
||||||
*/
|
*/
|
||||||
interface DrinkWaterMapper : BaseMapper<DrinkWaterUser> {
|
interface DrinkWaterMapper : BaseMapper<DrinkWaterUser>
|
||||||
}
|
|
||||||
|
14
src/main/resources/application-prod-remote.yml
Normal file
14
src/main/resources/application-prod-remote.yml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
bot:
|
||||||
|
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://101.35.164.171:3306/mirai?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||||
|
username: mirai
|
||||||
|
password: FydsaZsFm5w26We6
|
@ -10,5 +10,5 @@ spring:
|
|||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
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
|
url: jdbc:mysql://10.0.4.16:3306/mirai?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||||
username: root
|
username: mirai
|
||||||
password: FydsaZsFm5w26We6
|
password: FydsaZsFm5w26We6
|
||||||
|
Loading…
Reference in New Issue
Block a user