tnze / coolq-golang-sdk Goto Github PK
View Code? Open in Web Editor NEW酷Q插件Go语言SDK
License: GNU General Public License v3.0
酷Q插件Go语言SDK
License: GNU General Public License v3.0
你好,能抽空把好友列表相关接口加上吗?
Generating app.json
cqcfg: 统计Git提交数失败: exit status 128
app.go:5: running "cqcfg": exit status 1
v2版本无法自动扫描app.go中的cqp.GetGroupInfo权限配置
in CoolQ C++ SDK, it uses no_cache:
Group get_group_info(const int64_t group_id, const bool no_cache = false) noexcept(false);
however, noCatch is just a seems little confusing, and there's no docs about it
CoolQ-Golang-SDK/cqp/manual_native.go
Line 23 in 0a5baf0
Golang
写一个功能相同且关键代码完全一致的Go文件,在该Ubuntu 18.04中运行可以成功读取同一指定文件并打印输出文件内容。app.go文件的代码如下:
package main
import (
"fmt"
"github.com/Tnze/CoolQ-Golang-SDK/cqp"
"io/ioutil"
"os"
)
//go:generate cqcfg -c .
// cqp: 名称: CoolQ-plugins
// cqp: 版本: 1.0.0:1
// cqp: 作者: U
// cqp: 简介: 在QQ群里查看某类小文件~
func main() { /*此处应当留空*/ }
func init() {
cqp.AppID = "me.cqp.test34.list" // TODO: 修改为这个插件的ID
cqp.GroupMsg = onGroupMsg
}
func onGroupMsg(subType, msgID int32, fromGroup, fromQQ int64, fromAnonymous, msg string, font int32) int32 {
defer handlePanic()
if msg == "#list" {
reply := handleCmd()
cqp.SendGroupMsg(fromGroup, reply)
}
return 0
}
func handleCmd() string {
filename := "/opt/dir/some_data.json"
if !checkFileIsExist(filename) {
return "文件不存在"
}
file, err := os.Open(filename)
if err != nil {
return "文件打开失败"
}
b, err := ioutil.ReadAll(file)
if err != nil {
return "文件读取失败"
}
defer file.Close()
return string(b)
}
func handlePanic() {
if r := recover(); r != nil {
cqp.AddLog(cqp.Error, "未知错误", fmt.Sprint(r))
return
}
}
func checkFileIsExist(filename string) bool {
var exist = true
if _, err := os.Stat(filename); os.IsNotExist(err) {
exist = false
}
return exist
}
如题 卡在生成dll那步,所需环境都搭建好了,最好有视频教程过程感谢。
如题, 看了一圈文档和 issue 里的截图, 发现好像没有菜单功能, 所有的菜单都是一个 "详情", 实际上只需要加入对于菜单项点击的处理事件就行了, 至于去拉出来 GUI 界面之类的事情就从自己的函数里处理了
函数头都拟好了, 就叫:
// 或者 SetMenuItem
func AddMenuItem(title string, position uint8, handler func() int32) int32
请问 我现在装的64位golang ,没有安装gcc,
如果要编写酷Q 插件 ,要把golang 换成32位的吗?
gcc 是用64的还是32的,希望能出个入门教程。
尝试在项目中引入 github.com/mattn/go-sqlite3
但编译的 dll 总是无法被酷q 正确 load。
折腾后发现,只要引入 go-sqlite3 编译出来的 dll 就一定无法被酷q 正确加载,总是报
错误:不是合法的应用(LoadLibrary 失败,GetLastError=126)(-103)
附上最小测试:
package main
import (
"github.com/Tnze/CoolQ-Golang-SDK/cqp"
_ "github.com/mattn/go-sqlite3"
)
//go:generate cqcfg -c .
// cqp: 名称: 测试
// cqp: 版本: 1.0.0:0
// cqp: 作者: doylecnn
// cqp: 简介: 测试
func main() { /*此处应当留空*/ }
func init() {
cqp.AppID = "me.robirt.test" // TODO: 修改为这个插件的ID
cqp.PrivateMsg = onPrivateMsg
}
func onPrivateMsg(subType, msgID int32, fromQQ int64, msg string, font int32) int32 {
cqp.SendPrivateMsg(fromQQ, msg) //复读机
return 0
}
使用的是build.bat打包
如题
可以正常使用了吗?
package main
import (
"fmt"
"github.com/Tnze/CoolQ-Golang-SDK/cqp"
"github.com/yliu7949/MCDaemon-go/plugins/ChatPlugin"
)
//go:generate cqcfg -c .
// cqp: 名称: CoolQ-ChatTest
// cqp: 版本: 1.0.0:1
// cqp: 作者: Tom
// cqp: 简介: 在QQ群里使用Websocket进行通讯~
func main() { /*此处应当留空*/ }
func init() {
cqp.AppID = "me.cqp.tom.chattest" // TODO: 修改为这个插件的ID
cqp.PrivateMsg = onPrivateMsg
}
func onPrivateMsg(subType, msgID int32, fromQQ int64, msg string, font int32) int32 {
if msg[:5] == "#chat" {
handleCmd(msg,fromQQ)
}
return 0
}
func handleCmd(msg string, fromQQ int64) {
packageChan = make(chan *msgPackage, ChanMaxSize)
fmt.Println(packageChan)
go func() {fmt.Println("123")}()
cqp.SendPrivateMsg(fromQQ, msg)
return
}
var packageChan chan *msgPackage
const ChanMaxSize int = 20
type msgPackage struct {
From int //服务器id
Msg *ChatPlugin.Message
}
go.mod文件
module main
go 1.13
require (
github.com/Tnze/CoolQ-Golang-SDK v1.2.1
github.com/yliu7949/MCDaemon-go v0.0.0-20200505071320-e4adce8ba83e
)
不说多的,就两个字,牛逼!
Line 64 in f7266c1
这个函数用不了啊,不能撤回群消息。也不能撤回自己的消息。
go get github.com/Tnze/CoolQ-Golang-SDK/v2/tools/cqcfg
package github.com/Tnze/CoolQ-Golang-SDK/v2/tools/cqcfg: cannot find package "github.com/Tnze/CoolQ-Golang-SDK/v2/tools/cqcfg" in any of:
/usr/lib/golang/src/github.com/Tnze/CoolQ-Golang-SDK/v2/tools/cqcfg (from $GOROOT)
/opt/gopath/src/github.com/Tnze/CoolQ-Golang-SDK/v2/tools/cqcfg (from $GOPATH)
我按照readme里面的步骤,却提示无法找到包,
拒绝请求或是同意请求是怎么实现的,文档里面没看到相关说明,好像是只能看见相关请求消息?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.