Giter Club home page Giter Club logo

cqcppsdk's Introduction

CoolQ C++ SDK

License Tag QQ 群 Telegram QQ 版本发布群 Telegram 版本发布频道

CoolQ C++ SDK(或称 cqcppsdk、CQCPPSDK)是为了方便使用 C++ 开发 酷Q 应用而生的一个开发框架,封装了与 酷Q 提供的 DLL 接口相关的底层逻辑,对外提供更现代的 C++ 接口,从而提高应用开发效率,与此同时保持 C++ native 的性能优势。

示例

#include <iostream>
#include <set>
#include <sstream>

#include <cqcppsdk/cqcppsdk.h>

using namespace cq;
using namespace std;

CQ_INIT {
    on_enable([] { logging::info("启用", "插件已启用"); });

    on_private_message([](const PrivateMessageEvent &e) {
        try {
            auto msgid = send_private_message(e.user_id, e.message); // 直接复读消息
            logging::info_success("私聊", "私聊消息复读完成, 消息 Id: " + to_string(msgid));
        } catch (ApiError &e) {
            logging::warning("私聊", "私聊消息复读失败, 错误码: " + e.code);
        }
    });

    on_group_upload([](const auto &e) { // 可以使用 auto 自动推断类型
        stringstream ss;
        ss << "您上传了一个文件, 文件名: " << e.file.name << ", 大小(字节): " << e.file.size;
        try {
            send_message(e.target, ss.str());
        } catch (ApiError &) {
        }
    });
}

CQ_MENU(menu_demo_1) { logging::info("菜单", "点击菜单1"); }

使用方法

请参考 文档请不要在阅读文档之前直接下载本仓库代码,除非你知道你在做什么。

应用案例

项目 简介
richardchien/xiaofan-bot CQMOE 小秘书莫小凡

问题反馈

如果使用过程中遇到任何问题、Bug,或有其它意见或建议,欢迎提 issue

也欢迎加入 QQ 交流群 590842375 来和大家讨论~

cqcppsdk's People

Contributors

moemod avatar stdrc 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.