Skip to content

Latest commit

 

History

History
124 lines (93 loc) · 6.48 KB

README_EN.md

File metadata and controls

124 lines (93 loc) · 6.48 KB

title

McBot

✨ Based on OneBot protocol's MineCraft QQ Robot✨


issues CurseForge Download License

简体中文 | LTS | QuickStart

LTS

Forge-all Fabric-all

QuickStart

Use api to request

public class TestCmd {
    public static ArgumentBuilder<CommandSourceStack, ?> register() {
        return Commands.literal("test")
                .executes(TestCmd::execute);
    }

    public static int execute(CommandContext<CommandSourceStack> context) throws CommandSyntaxException {
        System.out.println(McBot.bot.sendGroupMsg(337631140, MsgUtils.builder().text("1").build(), true));
        //send msg to group
        return 0;
    }
}

Event Listener Instance

public class WebSocketServerTest {
    public static void main(String[] args) throws Exception {
        public static LinkedBlockingQueue<String> blockingQueue = new LinkedBlockingQueue<>();//use queue
        public static Thread app = new Thread(() -> {
            service = new ConnectFactory(new BotConfig(), blockingQueue);//create websocket session
            bot = service.ws.createBot();//create bot instance
        }, "BotServer");
        app.start();
        EventBus bus = new EventBus(blockingQueue);//create bus
        GroupMessageListener groupMessageListener = new GroupMessageListener();
        groupMessageListener.addHandler("天气", new Handler<GroupMessageEvent>() {
            @Override
            public void handle(GroupMessageEvent groupMessage) {
                System.out.println(groupMessage);

            }
        });
        bus.addListener(groupMessageListener);//add listener
        bus.addListener(new SimpleListener<PrivateMessageEvent>() {//private chat listener
            @Override
            public void onMessage(PrivateMessageEvent privateMessage) {
                System.out.println(privateMessage);
            }
        });

    }
}

Client

McBot OneBot-v11 developed with standard protocols, compatible with all One Bot protocol clients that support forward Web sockets

Project Address Platform Authors Note
koishijs/koishi koishi shigma
onebot-walle/walle-q abrahum
Yiwen-Chan/OneBot-YaYa 先驱 kanri
richardchien/coolq-http-api CKYU richardchien Can be used by mirai-native
Mrs4s/go-cqhttp MiraiGo Mrs4s
yyuueexxiinngg/OneBot-Mirai Mirai yyuueexxiinngg
takayama-lily/onebot OICQ takayama

Credits

License

This product is licensed under the GNU General Public License version 3. The license is as published by the Free Software Foundation published at https://www.gnu.org/licenses/gpl-3.0.html.

Alternatively, this product is licensed under the GNU Lesser General Public License version 3 for non-commercial use. The license is as published by the Free Software Foundation published at https://www.gnu.org/licenses/lgpl-3.0.html.

Feel free to contact us if you have any questions about licensing or want to use the library in a commercial closed source product.

Thanks

Thanks JetBrains Provide Free License Support OpenSource Project

Stargazers over time

Stargazers over time