Code Monkey home page Code Monkey logo

mcbotpp's Introduction

mirai-cpp-template

mirai-cpp 机器人项目模板

使用方法

使用以下指令克隆本仓库

git clone https://github.com/cyanray/mirai-cpp-template.git --recursive
cd mirai-cpp-template
# 更新 mirai-cpp 到最新
git submodule update --init --force --remote

然后使用 Visual Studio 或 Visual Studio Code 直接打开整个文件夹即可。

本模板编译目标为可执行文件,其主函数位于 src/main.cpp

头文件请添加到 include 目录中

源文件请添加到 src 目录中,并且不要忘记修改 CMakeLists.txt。(参考CMakeLists.txt中的注释进行修改)

mirai-cpp 的说明文档:使用说明

切换 mirai-cpp 版本

1. 更新到最新版 mirai-cpp

直接在 template 项目根目录执行以下指令:

# 更新 mirai-cpp 到最新
git submodule update --init --force --remote

2. 使用特定版本的 mirai-cpp

如果你目前使用的是旧版本的 mirai/mirai-console/mirai-api-http,请根据 mirai-api-http 的版本号选择对应的 mirai-cpp 版本,以保证兼容性。

例如,mirai-api-http 的版本为 1.8.4,那么请使用 mirai-cpp v1.8.4

切换方法如下:

cd mirai-cpp
git pull
git checkout v1.8.4

编译出 Linux 可执行文件、部署到服务器上

操作方法:

  1. 在 WSL 上编译出二进制可执行文件
  2. 把编译出来的二进制可执行文件复制到自己的服务器上

以下内容需要你了解 WSL (Windows Subsystem for Linux) 。

使用 Visual Studio 的 CMake 项目可以很轻松的在 WSL 上进行编译。

按照如图所示步骤,创建一个针对 WSL 平台的配置。因为我的 WSL 安装了 GCC 编译器,所以这里选择 WSL-GCC-Releas

创建WSL-GCC平台配置1

创建WSL-GCC平台配置2

之后将配置切换到刚刚创建的 WSL 平台配置,重新编译项目,编译出来的二进制文件就在 [本模板所在的目录]/out/build/WSL-Release/ 目录下了(不出意外的话,它叫做 my-qqrobot )。

把这个文件复制到你的 Linux 服务器上,可以直接运行!

mcbotpp's People

Contributors

wzyyyyyyy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.