mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ad89a17680
@ -1,6 +1,6 @@
|
||||
# Mirai
|
||||
|
||||
一个以<b>TIM QQ协议</b>驱动的JAVA(+Kotlin) QQ机器人服务端核心
|
||||
一个以<b>TIM QQ协议(非web)</b>驱动的JAVA(+Kotlin) QQ机器人服务端核心
|
||||
我们坚持免费与开源
|
||||
|
||||
项目处于快速开发阶段
|
||||
|
@ -16,6 +16,12 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.mamoe</groupId>
|
||||
<artifactId>mirai-core</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -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
|
||||
}
|
||||
|
59
mirai-api/src/main/java/net/mamoe/mirai/MiraiAPI.java
Normal file
59
mirai-api/src/main/java/net/mamoe/mirai/MiraiAPI.java
Normal 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);
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package net.mamoe.mirai;
|
||||
|
||||
public class MiraiConsole {
|
||||
public static void main(String[] args){
|
||||
|
||||
}
|
||||
}
|
@ -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>
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user