Merge remote-tracking branch 'origin/master'

This commit is contained in:
Him188moe 2019-09-15 12:20:47 +08:00
commit ad89a17680
10 changed files with 147 additions and 35 deletions

View File

@ -1,6 +1,6 @@
# Mirai
一个以<b>TIM QQ协议</b>驱动的JAVA(+Kotlin) QQ机器人服务端核心
一个以<b>TIM QQ协议(非web)</b>驱动的JAVA(+Kotlin) QQ机器人服务端核心
我们坚持免费与开源
项目处于快速开发阶段

View File

@ -16,6 +16,12 @@
<dependencies>
<dependency>
<groupId>net.mamoe</groupId>
<artifactId>mirai-core</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

View File

@ -1,15 +1,63 @@
package net.mamoe.mirai;
import net.mamoe.mirai.utils.BotAccount;
import lombok.Getter;
import java.io.Closeable;
import java.util.ArrayList;
import java.util.List;
public class Bot {
@Getter
private final long qq;
public Bot(long qq){
this.qq = qq;
}
public String getName(){
return "Bot";
}
public List<String> getOwners(){
return new ArrayList<>();
}
public List<Long> getFriends(){
return new ArrayList<>();
}
public void addFriend(){
}
public void deleteFriend(){
}
public void sendMessageTo(long qq, String message){
}
public List<Long> getGroups(){
return new ArrayList<>();
}
public void addGroup(){
}
public void quitGroup(){
}
public void sendGroupMessage(long group, String message){
}
public List<String> getMessageHistory(){
return new ArrayList<>();
}
/**
* @author Him188moe
*/
public interface Bot extends Closeable {
BotAccount getAccount();
// TODO: 2019/9/13 add more
}

View File

@ -0,0 +1,59 @@
package net.mamoe.mirai;
import java.util.ArrayList;
import java.util.List;
/**
* MiraiAPI provides
* - the status of the Mirai-Core
* - the fundamental bot operations.
* - the plugin status.
*
* It was designed for users, not developers,
* Web-based controller, UI controller or console is depending on Mirai-API
*
* Mirai-API does NOT contains fancy objects, and this means there are less functions it can do compare with Mirai-Core
*
* Again, for extending/developing Mirai, you should refer to Mirai-Core
* for only using , you should refer to Mirai-API
*/
public class MiraiAPI {
public static void startMirai(String[] args){
MiraiMain.main(args);
}
public static void closeMirai(){
MiraiServer.getInstance().shutdown();
}
public static void restartMirai(String[] args){
MiraiServer.getInstance().shutdown();
MiraiMain.main(args);
}
public static String getMiraiVersion(){
return MiraiServer.MIRAI_VERSION;
}
public static String getQQPortocolVersion(){
return MiraiServer.QQ_VERSION;
}
public static boolean isMiraiEnabled(){
return MiraiServer.getInstance()!=null;
}
public static List<String> getEnabledPluginList(){
return new ArrayList<>();
}
public static List<Long> getEnabledBots(){
return new ArrayList<>();
}
public static Bot getBot(long qq){
return new Bot(qq);
}
}

View File

@ -1,17 +0,0 @@
package net.mamoe.mirai.utils;
import lombok.Data;
/**
* @author Him188moe
*/
@Data
public final class BotAccount {
public final long qqNumber;
public final String password;
public BotAccount(long qqNumber, String password) {
this.qqNumber = qqNumber;
this.password = password;
}
}

View File

@ -0,0 +1,7 @@
package net.mamoe.mirai;
public class MiraiConsole {
public static void main(String[] args){
}
}

View File

@ -39,13 +39,6 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.mamoe</groupId>
<artifactId>mirai-api</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>

View File

@ -1,10 +1,13 @@
package net.mamoe.mirai;
import lombok.Getter;
/**
* @author NaturalHG
*/
public final class MiraiMain {
@Getter
private static MiraiServer server;
public static void main(String[] args) {

View File

@ -35,9 +35,9 @@ public final class MiraiServer {
return instance;
}
private final static String MIRAI_VERSION = "1.0.0";
public final static String MIRAI_VERSION = "1.0.0";
private final static String QQ_VERSION = "4.9.0";
public final static String QQ_VERSION = "4.9.0";
@Getter //is running under UNIX

View File

@ -0,0 +1,13 @@
package net.mamoe.mirai.utils;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class BotAccount {
public final long qqNumber;
private final String password;
}