cqsdk_golang

package module
v0.0.0-...-33520d0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2018 License: GPL-3.0 Imports: 2 Imported by: 0

README

cqsdk-golang

酷q的go版本sdk

注意

此sdk只支持在docker下运行的酷q,win环境下运行的酷q调用api的时候会造成酷q闪退!
编译环境不限。

使用

> go get -u github.com/juzi5201314/cqsdk-golang

由于酷q插件必须是x86的,而cgo不支持跨平台编译。
所以如果编译环境并非windows x86,请看下面,否则跳过此段。

前往go官网或者go中文网下载go的weindows 32位源码包(编译环境是什么系统就下什么系统的,这里以编译环境是windows10 x64的为例)。

前往下载tmd-gcc 32位版,并安装。

解压go源码,如当前环境本来就存在64位的go环境,可以如我这样将32位的解压在比如C:\Go32。

将tmd-gcc安装目录(一般是在C:\TMD-GCC-32)添加到环境变量(其他系统同理,下载个32位的gcc)。

1,打开命令行,cd到插件源码目录(以demo为例)。
2,执行

> C:\Go32\bin\go.exe build -buildmode=c-shared -o cn.you.test.dll

3, 将cn.you.test.dll动态库与cn.you.test.json放到酷q的app目录,打包,完成。

sdk

提供
cqsdk-golang.Gb18030(utf8 string) string
此方法将utf8编码的字符串转换成酷q需要的gb18030编码。sdk内置api已自动转换,调用api时直接填入utf8字符串即可,此方法使用较少。

cqsdk-golang.Utf8(gb18030 string) string 此方法将gb18030编码的字符串解码成utf8编码的字符串。由于酷q事件传入的是gb18030编码的,所以接收const char *的时候除了使用C.GoString来将C类型转换成go的字符串之后,还需要gb18030解码.
具体操作请看demo

Documentation

Index

Constants

View Source
const (
	EVENT_IGNORE        = iota     //忽略事件
	EVENT_BLOCK                    //拦截事件
	REQUEST_ALLOW       = iota + 1 //请求_通过
	REQUEST_DENY                   //请求_拒绝
	REQUEST_GROUPADD    = iota + 1 //请求_群添加
	REQUEST_GROUPINVITE            //请求_群邀请
	CQLOG_DEBUG         = 0        //调试 灰色
	CQLOG_INFO          = 10       //信息 黑色
	CQLOG_INFOSUCCESS   = 11       //信息(成功) 紫色
	CQLOG_INFORECV      = 12       //信息(接收) 蓝色
	CQLOG_INFOSEND      = 13       //信息(发送) 绿色
	CQLOG_WARNING       = 20       //警告 橙色
	CQLOG_ERROR         = 30       //错误 红色
	CQLOG_FATAL         = 40       //致命错误 深红
)

Variables

View Source
var AUTHCODE C.int32_t

Functions

func AddLog

func AddLog(p int32, h string, msg string) int32

func DeleteMsg

func DeleteMsg(message_id int64) int32

func Gb18030

func Gb18030(c string) *C.char

func GetAppDirectory

func GetAppDirectory() string

func GetCookies

func GetCookies() string

func GetCsrfToken

func GetCsrfToken() int32

func GetGroupMemberInfo

func GetGroupMemberInfo(group_id int64, qq int64, oncache bool) string

func GetLoginNick

func GetLoginNick() string

func GetLoginQQ

func GetLoginQQ() int64

func GetRecord

func GetRecord(file string, outformat string) string

func GetStrangerInfo

func GetStrangerInfo(qq int64, oncache bool) string

func SendDiscussMsg

func SendDiscussMsg(discuss_id int64, message string) int32

func SendGroupMsg

func SendGroupMsg(group_id int64, message string) int32

func SendLike

func SendLike(qq int64) int32

func SendPrivateMsg

func SendPrivateMsg(from_qq int64, message string) int32

func SetAuthCode

func SetAuthCode(c int32)

func SetDiscussLeave

func SetDiscussLeave(discuss_id int64) int32

func SetFatal

func SetFatal(message string) int32

func SetFriendAddRequest

func SetFriendAddRequest(responseflag string, responseoperation int32, remark string) int32

func SetGroupAddRequest

func SetGroupAddRequest(responseflag string, requesttype int32, responseoperation int32, reason string) int32

func SetGroupAdmin

func SetGroupAdmin(group_id int64, qq int64, isadmin bool) int32

func SetGroupAnonymous

func SetGroupAnonymous(group_id int64, enableanomymous bool) int32

func SetGroupAnonymousBan

func SetGroupAnonymousBan(group_id int64, anomymous string, duration int64) int32

func SetGroupBan

func SetGroupBan(group_id int64, qq int64, duration int64) int32

func SetGroupCard

func SetGroupCard(group_id int64, qq int64, newcard string) int32

func SetGroupKick

func SetGroupKick(group_id int64, qq int64, rejectaddrequest bool) int32

func SetGroupLeave

func SetGroupLeave(group_id int64, isdismiss bool) int32

func SetGroupSpecialTitle

func SetGroupSpecialTitle(group_id int64, qq int64, title string, duration int64) int32

func SetGroupWholeBan

func SetGroupWholeBan(group_id int64, enableban bool) int32

func Utf8

func Utf8(c string) string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL