Skip to content

Commit

Permalink
feat(client): upgrade SDK and add new features
Browse files Browse the repository at this point in the history
- Upgrade OneBot SDK from 0.3.0 to0.3.1
- Add new methods in Bot class to support additional actions
- Update ActionFactory and ActionSendUnit for new functionalities
- Modify build.gradle for new dependencies and versions- Update gradle.properties for new client and SDK versions
- Add ReflectionUtils class for dynamic class loading
- Update ConnectionUtils for better self ID parsing
  • Loading branch information
cnlimiter committed Feb 11, 2025
1 parent 8e3bec7 commit 51e777b
Show file tree
Hide file tree
Showing 13 changed files with 423 additions and 47 deletions.
15 changes: 8 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ configurations {


repositories {
maven { url = "https://repo.papermc.io/repository/maven-public/" }
mavenLocal()
maven { url = "https://maven.nova-committee.cn/releases"}
maven { url = "https://repo.papermc.io/repository/maven-public/" }
mavenCentral()
}

Expand All @@ -51,10 +52,10 @@ dependencies {
testCompileOnly("org.projectlombok:lombok:1.18.24")
testRuntimeOnly 'org.slf4j:slf4j-simple:2.0.6'

shadow "net.kyori:event-api:${eventbus_version}"
shadow "net.kyori:event-method:${eventbus_version}"
shadow "cn.evole.onebot:OneBot-SDK:${sdk_version}"
shadow "org.java-websocket:Java-WebSocket:${websocket_version}"
implementation "net.kyori:event-api:${eventbus_version}"
implementation "net.kyori:event-method:${eventbus_version}"
implementation "cn.evole.onebot:OneBot-SDK:${sdk_version}"
implementation "org.java-websocket:Java-WebSocket:${websocket_version}"

annotationProcessor("org.projectlombok:lombok:1.18.24")

Expand Down Expand Up @@ -93,8 +94,8 @@ publishing {
repositories {
if (System.getenv('MAVEN_USERNAME') != null && System.getenv('MAVEN_PASSWORD') != null) {
maven {
name 'release'
url = 'https://maven.nova-committee.cn/releases'
name 's3'
url = 'https://maven.nova-committee.cn/s3'

credentials {
username System.getenv('MAVEN_USERNAME')
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ org.gradle.jvmargs=-Xmx1G

maven_group=cn.evole.onebot
archives_base_name=OneBot-Client
client_version=0.4.1
client_version=0.4.2

java_version=8
sdk_version=0.3.0
sdk_version=0.3.1
eventbus_version=3.0.0
websocket_version=1.5.7
websocket_version=1.6.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 4 additions & 0 deletions src/main/java/cn/evole/onebot/client/OneBotClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public static OneBotClient create(BotConfig config){
return new OneBotClient(config);
}

public static OneBotClient create(BotConfig config, Listener... listeners){
return new OneBotClient(config).registerEvents(listeners);
}

public OneBotClient open() {
String token = config.getToken();
long botId = config.getBotId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Bot createBot(){
@Override
public void onOpen(ServerHandshake handshake) {
client.getLogger().info("▌ §c已连接到服务器 §a┈━═☆");
//handshake.iterateHttpFields().forEachRemaining(s -> System.out.println(s + ": " + handshake.getFieldValue(s)));
handshake.iterateHttpFields().forEachRemaining(s -> System.out.println(s + ": " + handshake.getFieldValue(s)));
}

@Override
Expand Down
Loading

0 comments on commit 51e777b

Please sign in to comment.