dice

package
v0.0.0-...-9415ce5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 118 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unload int = iota
	Loaded
	LoadError
)
View Source
const (
	DodoPermManageMember = 1 << 2
	DodoPermAdmin        = 1 << 3
)
View Source
const (
	StateCodeInit                      = 0
	StateCodeInLogin                   = 1
	StateCodeInLoginQrCode             = 2
	GoCqhttpStateCodeInLoginBar        = 3
	GoCqhttpStateCodeInLoginVerifyCode = 6
	StateCodeInLoginDeviceLock         = 7
	StateCodeLoginSuccessed            = 10
	StateCodeLoginFailed               = 11
	GoCqhttpStateCodeClosed            = 20
)
View Source
const (
	RolePermissionAdmin                  kook.RolePermission = 1 << iota
	RolePermissionManageGuild            kook.RolePermission = 1 << 1
	RolePermissionViewAuditLog           kook.RolePermission = 1 << 2
	RolePermissionCreateInvite           kook.RolePermission = 1 << 3
	RolePermissionManageInvite           kook.RolePermission = 1 << 4
	RolePermissionManageChannel          kook.RolePermission = 1 << 5
	RolePermissionKickUser               kook.RolePermission = 1 << 6
	RolePermissionBanUser                kook.RolePermission = 1 << 7
	RolePermissionManageGuildEmoji       kook.RolePermission = 1 << 8
	RolePermissionChangeNickname         kook.RolePermission = 1 << 9
	RolePermissionManageRolePermission   kook.RolePermission = 1 << 10
	RolePermissionViewChannel            kook.RolePermission = 1 << 11
	RolePermissionSendMessage            kook.RolePermission = 1 << 12
	RolePermissionManageMessage          kook.RolePermission = 1 << 13
	RolePermissionUploadFile             kook.RolePermission = 1 << 14
	RolePermissionConnectVoice           kook.RolePermission = 1 << 15
	RolePermissionManageVoice            kook.RolePermission = 1 << 16
	RolePermissionMentionEveryone        kook.RolePermission = 1 << 17
	RolePermissionCreateReaction         kook.RolePermission = 1 << 18
	RolePermissionFollowReaction         kook.RolePermission = 1 << 19
	RolePermissionInvitedToVoice         kook.RolePermission = 1 << 20
	RolePermissionForceManualVoice       kook.RolePermission = 1 << 21
	RolePermissionFreeVoice              kook.RolePermission = 1 << 22
	RolePermissionVoice                  kook.RolePermission = 1 << 23
	RolePermissionManageUserVoiceReceive kook.RolePermission = 1 << 24
	RolePermissionManageUserVoiceCreate  kook.RolePermission = 1 << 25
	RolePermissionManageNickname         kook.RolePermission = 1 << 26
	RolePermissionPlayMusic              kook.RolePermission = 1 << 27
)

kook go的鉴权目前并不好用,这里重写一遍

View Source
const (
	WqStateCodeInit              = 0
	WqStateCodeInLogin           = 1
	WqStateCodeInLoginQrCode     = 2
	WqStateCodeInLoginBar        = 3
	WqStateCodeInLoginVerifyCode = 6
	WqStateCodeInLoginDeviceLock = 7
	WqStateCodeLoginSuccessed    = 10
	WqStateCodeLoginFailed       = 11
	WqStateCodeClosed            = 20
)
View Source
const BackupDir = "./backups"
View Source
const HelpBuiltinGroup = "builtin"
View Source
const HelpConfigFilename = "help_config.yaml"

RolePermissionAll 有两种情况会使一个用户拥有一个服务器内的所有权限,第一种是作为服务器创建者的用户,即Owner,第二种是被授予了Admin权限的用户 但是尽管他们可以bypass所有的权限检查,但是他们自身并不一定拥有所有的权限,这导致检查时会出现问题,因此这里创建一个permissionAll权限, 并把Admin和Owner当作拥有该权限的用户进行处理

View Source
const SatoriProtocolVersion = "v1"

Variables

View Source
var (
	APPNAME = "SealDice"

	// VERSION 版本号,按固定格式,action 在构建时可能会自动注入部分信息
	// 正式:主版本号+yyyyMMdd,如 1.4.5+20240308
	// dev:主版本号-dev+yyyyMMdd.7位hash,如 1.4.5-dev+20240308.1a2b3c4
	// rc:主版本号-rc.序号+yyyyMMdd.7位hash如 1.4.5-rc.0+20240308.1a2b3c4,1.4.5-rc.1+20240309.2a3b4c4,……
	VERSION = semver.MustParse(VERSION_MAIN + VERSION_PRERELEASE + VERSION_BUILD_METADATA)

	// VERSION_MAIN 主版本号
	VERSION_MAIN = "1.4.6"
	// VERSION_PRERELEASE 先行版本号
	VERSION_PRERELEASE = "-dev"
	// VERSION_BUILD_METADATA 版本编译信息
	VERSION_BUILD_METADATA = ""

	// APP_CHANNEL 更新频道,stable/dev,在 action 构建时自动注入
	APP_CHANNEL = "dev" //nolint:revive

	VERSION_CODE = int64(1004005) //nolint:revive

	VERSION_JSAPI_COMPATIBLE = []*semver.Version{
		VERSION,
		semver.MustParse("1.4.5"),
		semver.MustParse("1.4.4"),
		semver.MustParse("1.4.3"),
	}
)
View Source
var BackendUrls = []string{
	"http://dice.weizaima.com",
}
View Source
var BanRankText = map[BanRankType]string{
	BanRankTrusted: "信任",
	BanRankBanned:  "禁止",
	BanRankWarn:    "警告",
	BanRankNormal:  "常规",
}
View Source
var CensorHandlerText = map[CensorHandler]string{
	SendWarning: "SendWarning",
	SendNotice:  "SendNotice",
	BanUser:     "BanUser",
	BanGroup:    "BanGroup",
	BanInviter:  "BanInviter",
	AddScore:    "AddScore",
}
View Source
var ErrGroupCardOverlong = errors.New("群名片长度超过限制")
View Source
var GocqAppVersionMap = map[string]map[ProtocolType]GocqAppVersion{
	"8.9.63": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537164840,
			SubAppID:        537164840,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.63.11390",
			BuildTime:       1685069178,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2546",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1687796862,
			Qua:             "V1_AND_SQ_8.9.63_4194_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537164888,
			SubAppID:        537164888,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.63.11390",
			BuildTime:       1685069178,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2546",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1687796862,
			Qua:             "V1_AND_SQ_8.9.63_4194_YYB_D",
			ProtocolType:    6,
		},
	},
	"8.9.68": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537168313,
			SubAppID:        537168313,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.68.11565",
			BuildTime:       1688523354,
			ApkSign:         "7772804f3cb4961f57cb764fbe4973e6",
			SdkVersion:      "6.0.0.2549",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1689780543,
			Qua:             "V1_AND_SQ_8.9.68_4264_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537168361,
			SubAppID:        537168361,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.68.11565",
			BuildTime:       1688523354,
			ApkSign:         "7772804f3cb4961f57cb764fbe4973e6",
			SdkVersion:      "6.0.0.2549",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1689780543,
			Qua:             "V1_AND_SQ_8.9.68_4264_YYB_D",
			ProtocolType:    6,
		},
	},
	"8.9.70": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537169928,
			SubAppID:        537169928,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.70.11730",
			BuildTime:       1689956914,
			ApkSign:         "e686fa90d9a33950c46de9cfb4ec7e71",
			SdkVersion:      "6.0.0.2551",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1690350020,
			Qua:             "V1_AND_SQ_8.9.70_4330_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537169976,
			SubAppID:        537169976,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.70.11730",
			BuildTime:       1689956914,
			ApkSign:         "e686fa90d9a33950c46de9cfb4ec7e71",
			SdkVersion:      "6.0.0.2551",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1690350020,
			Qua:             "V1_AND_SQ_8.9.70_4330_YYB_D",
			ProtocolType:    6,
		},
	},
	"8.9.73": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537171007,
			SubAppID:        537171007,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.73.11790",
			BuildTime:       1690515318,
			ApkSign:         "d4dd51c0a4a7a37f7fa9d791cd1c0377",
			SdkVersion:      "6.0.0.2553",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1690715354,
			Qua:             "V1_AND_SQ_8.9.73_4354_HDBM_T",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537171018,
			SubAppID:        537171018,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.73.11790",
			BuildTime:       1690515318,
			ApkSign:         "d4dd51c0a4a7a37f7fa9d791cd1c0377",
			SdkVersion:      "6.0.0.2553",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1690715354,
			Qua:             "V1_AND_SQ_8.9.73_4354_HDBM_T",
			ProtocolType:    6,
		},
	},
	"8.9.76": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537173477,
			SubAppID:        537173477,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.76.12115",
			BuildTime:       1691565978,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2554",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1691565978,
			Qua:             "V1_AND_SQ_8.9.76_4484_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537173525,
			SubAppID:        537173525,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.76.12115",
			BuildTime:       1691565978,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2554",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1691565978,
			Qua:             "V1_AND_SQ_8.9.76_4484_YYB_D",
			ProtocolType:    AndroidPad,
		},
	},
	"8.9.78": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537175315,
			SubAppID:        537175315,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.78.12275",
			BuildTime:       1691565978,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2554",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1691565978,
			Qua:             "V1_AND_SQ_8.9.78_4548_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537175354,
			SubAppID:        537175354,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.78.12275",
			BuildTime:       1691565978,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2554",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1691565978,
			Qua:             "V1_AND_SQ_8.9.78_4548_YYB_D",
			ProtocolType:    6,
		},
	},

	"8.9.80": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537176863,
			SubAppID:        537176863,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.80.12440",
			BuildTime:       1691565978,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2554",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1691565978,
			Qua:             "V1_AND_SQ_8.9.80_4614_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537176902,
			SubAppID:        537176902,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.80.12440",
			BuildTime:       1691565978,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2554",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1691565978,
			Qua:             "V1_AND_SQ_8.9.80_4614_YYB_D",
			ProtocolType:    6,
		},
	},

	"8.9.83": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537178646,
			SubAppID:        537178646,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.83.12605",
			BuildTime:       1691565978,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2554",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1691565978,
			Qua:             "V1_AND_SQ_8.9.83_4680_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537178685,
			SubAppID:        537178685,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.83.12605",
			BuildTime:       1691565978,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2554",
			SsoVersion:      20,
			MiscBitmap:      150470524,
			MainSigMap:      34869472,
			SubSigMap:       66560,
			DumpTime:        1691565978,
			Qua:             "V1_AND_SQ_8.9.83_4680_YYB_D",
			ProtocolType:    6,
		},
	},

	"8.9.85": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537180568,
			SubAppID:        537180568,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.85.12820",
			BuildTime:       1697015435,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2556",
			SsoVersion:      21,
			MiscBitmap:      150470524,
			MainSigMap:      16724722,
			SubSigMap:       66560,
			DumpTime:        1697015435,
			Qua:             "V1_AND_SQ_8.9.85_4766_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537179875,
			SubAppID:        537179875,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.85.12820",
			BuildTime:       1697015435,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2556",
			SsoVersion:      21,
			MiscBitmap:      150470524,
			MainSigMap:      16724722,
			SubSigMap:       66560,
			DumpTime:        1697015435,
			Qua:             "V1_AND_SQ_8.9.85_4766_YYB_D",
			ProtocolType:    6,
		},
	},
	"8.9.88": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537182769,
			SubAppID:        537182769,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.88.13035",
			BuildTime:       1697015435,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2556",
			SsoVersion:      21,
			MiscBitmap:      150470524,
			MainSigMap:      16724722,
			SubSigMap:       66560,
			DumpTime:        1697015435,
			Qua:             "V1_AND_SQ_8.9.88_4852_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537182808,
			SubAppID:        537182808,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.88.13035",
			BuildTime:       1697015435,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2556",
			SsoVersion:      21,
			MiscBitmap:      150470524,
			MainSigMap:      16724722,
			SubSigMap:       66560,
			DumpTime:        1697015435,
			Qua:             "V1_AND_SQ_8.9.88_4852_YYB_D",
			ProtocolType:    6,
		},
	},
	"8.9.90": {
		AndroidPhone: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537185007,
			SubAppID:        537185007,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.90.13250",
			BuildTime:       1697015435,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2556",
			SsoVersion:      21,
			MiscBitmap:      150470524,
			MainSigMap:      16724722,
			SubSigMap:       66560,
			DumpTime:        1697015435,
			Qua:             "V1_AND_SQ_8.9.90_4938_YYB_D",
			ProtocolType:    AndroidPhone,
		},
		AndroidPad: {
			ApkID:           "com.tencent.mobileqq",
			AppID:           537185046,
			SubAppID:        537185046,
			AppKey:          "0S200MNJT807V3GE",
			SortVersionName: "8.9.90.13250",
			BuildTime:       1697015435,
			ApkSign:         "a6b745bf24a2c277527716f6f36eb68d",
			SdkVersion:      "6.0.0.2556",
			SsoVersion:      21,
			MiscBitmap:      150470524,
			MainSigMap:      16724722,
			SubSigMap:       66560,
			DumpTime:        1697015435,
			Qua:             "V1_AND_SQ_8.9.90_4938_YYB_D",
			ProtocolType:    AndroidPhone,
		},
	},
}
View Source
var HelpMasterInfoDefault = "骰主很神秘,什么都没有说——"
View Source
var HelpMasterLicenseDefault = "请在遵守以下规则前提下使用:\n" +
	"1. 遵守国家法律法规\n" +
	"2. 在跑团相关群进行使用\n" +
	"3. 不要随意踢出、禁言、刷屏\n" +
	"4. 务必信任骰主,有事留言\n" +
	"如不同意使用.bot bye使其退群,谢谢。\n" +
	"祝玩得愉快。"
View Source
var IconPNG = []byte{} /* 10712 elements not displayed */
View Source
var ManiaListText = `` /* 6811-byte string literal not displayed */
View Source
var (
	// OfficialModPublicKey 官方 Mod 公钥
	OfficialModPublicKey = ``
)
View Source
var SVGIcon = []byte(`<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><defs><style>.cls-1{fill:#bdccd4;}.cls-2{fill:#fff;}</style></defs><title>icon-s</title><rect class="cls-1" x="6.36" y="7.14" width="498.86" height="498.86" rx="12"/><polygon class="cls-2" points="130.65 58.2 31.9 269.01 183.55 462.82 365.95 427.73 480.24 237.52 336.41 52 130.65 58.2"/><path d="M488.44,230.71,346.28,44.41h0a10.57,10.57,0,0,0-8.87-4.18L133.26,48.62h0a10.61,10.61,0,0,0-9.15,6L22.06,263h0a10.57,10.57,0,0,0,1.14,11.14l150.59,194.6a10.58,10.58,0,0,0,10.53,3.95L373.17,436l1.35-.46a10.59,10.59,0,0,0,5.72-4.71L489.16,242.44a10.6,10.6,0,0,0-.72-11.73ZM186,449.75l-24.1-187.3L385.9,376ZM364.21,107.21,159.67,244,140.55,72.87ZM149.65,248.53l-102.77,12L131.65,87.9ZM392.46,367.38,165.87,252.6l207-138.45,1.2,1.54,18.83,250.94ZM358.79,95.63,178.51,67.86,333,61.44ZM47.71,271.08l103.1-12L173.2,433.22ZM364.32,416l-120,23.36,135.29-49.82Zm38.14-65.88-16.62-219L467.21,238Z"/><polygon class="cls-2" points="157.03 220.4 160.14 249.69 178.19 258.84 374.4 120.32 373.55 108.64 358.48 106.33 157.03 220.4"/><path d="M297.84,193.19h0c-11-3.95-22.25-3.44-29.35,1.3-7.73,3.69-13.91,13-16.18,24.53C249,235.69,255,250.45,266,252.61c9.44,1.87,19.48-6.76,24-20.27,8.76,1.95,17,1,22.68-2.23a15,15,0,0,0,7-7.93C323.42,211.65,313.84,198.92,297.84,193.19Z"/><path d="M221.27,164c-8.94-3.2-18.77-2.18-27.68,2.88l-.08,0a44.16,44.16,0,0,0-19.37,23.68c-7.61,21.25,1.15,43.9,19.53,50.47,8.94,3.2,18.77,2.18,27.68-2.88l.08,0A44.16,44.16,0,0,0,240.8,214.5C248.41,193.25,239.65,170.61,221.27,164Z"/><ellipse class="cls-2" cx="194.6" cy="193" rx="21.33" ry="16.31" transform="translate(-62.71 287.4) rotate(-64.91)"/><circle class="cls-2" cx="225.91" cy="185.74" r="9.96"/><path d="M310.56,113.25a44.14,44.14,0,0,0-30.26,4.47,32.67,32.67,0,0,0-16.76,22.33c-3.78,19.15,11.16,38.29,33.3,42.66a44.15,44.15,0,0,0,30.26-4.47l.08-.05c8.92-5.06,14.84-13,16.68-22.28C347.64,136.76,332.7,117.62,310.56,113.25Z"/><ellipse class="cls-2" cx="286.98" cy="140.6" rx="21.33" ry="16.31" transform="translate(37.95 340.88) rotate(-64.91)"/><circle class="cls-2" cx="320.22" cy="132.25" r="9.96"/><ellipse cx="226.67" cy="154.45" rx="6.5" ry="9.75" transform="translate(-7.12 297.91) rotate(-65.8)"/><ellipse cx="252.33" cy="140.56" rx="9.75" ry="6.5" transform="translate(83.38 374.84) rotate(-83.32)"/></svg>`)
View Source
var (
	// SealTrustedClientPrivateKey 可信客户端私钥
	SealTrustedClientPrivateKey = ``
)
View Source
var SetCocRulePrefixText = map[int]string{
	0:  `0`,
	1:  `1`,
	2:  `2`,
	3:  `3`,
	4:  `4`,
	5:  `5`,
	11: `DeltaGreen`,
}
View Source
var SetCocRuleText = map[int]string{
	0:  "出1大成功\n不满50出96-100大失败,满50出100大失败(COC7规则书)",
	1:  "不满50出1大成功,满50出1-5大成功\n不满50出96-100大失败,满50出100大失败",
	2:  "出1-5且判定成功为大成功\n出96-100且判定失败为大失败",
	3:  "出1-5大成功\n出96-100大失败(即大成功/大失败时无视判定结果)",
	4:  "出1-5且≤(成功率/10)为大成功\n不满50出>=96+(成功率/10)为大失败,满50出100大失败",
	5:  "出1-2且≤(成功率/5)为大成功\n不满50出96-100大失败,满50出99-100大失败",
	11: "出1或检定成功基础上个位十位相同为大成功\n出100或检定失败基础上个位十位相同为大失败\n此规则无困难成功或极难成功",
}
View Source
var SimpleCocSuccessRankToText = map[int]string{
	-2: "大失败",
	-1: "失败",
	1:  "成功",
	2:  "困难成功",
	3:  "极难成功",
	4:  "大成功",
}

Functions

func AtBuild

func AtBuild(uid string) string

func Base64ToImageFunc

func Base64ToImageFunc(logger *zap.SugaredLogger) func(string) (string, error)

func BuiltinQQServeProcessKill

func BuiltinQQServeProcessKill(dice *Dice, conn *EndPointInfo)

func BuiltinQQServeProcessKillBase

func BuiltinQQServeProcessKillBase(dice *Dice, conn *EndPointInfo, isSync bool)

func CQRewrite

func CQRewrite(longText string, solve func(cq *CQCommand)) string

func CheckDialErr

func CheckDialErr(err error) syscall.Errno

func CommandCheckPrefix

func CommandCheckPrefix(rawCmd string, prefix []string, platform string) bool

func CommandCheckPrefixNew

func CommandCheckPrefixNew(rawCmd string, prefix []string) bool

CommandCheckPrefixNew for new command parser ExecuteNew func, 干掉了 AtParse 和 Platform 参数

func CompatibleReplace

func CompatibleReplace(ctx *MsgContext, s string) string

func CrashLog

func CrashLog()

func CrossMsgBySearch

func CrossMsgBySearch(se *IMSession, p, t, txt string, pr bool) bool

CrossMsgBySearch 在 se 中找到第一个平台等于 p 且启用的 EndPointInfo, 并向目标 t 发送消息, pr 判断是否为私聊消息

func CustomReplyConfigCheckExists

func CustomReplyConfigCheckExists(dice *Dice, filename string) bool

func CustomReplyConfigDelete

func CustomReplyConfigDelete(dice *Dice, filename string) bool

func DeckDelete

func DeckDelete(_ *Dice, deck *DeckInfo)

func DeckReload

func DeckReload(d *Dice)

func DeckRewrite

func DeckRewrite(longText string, solve func(text string) string) string

func DeckToRandomPool

func DeckToRandomPool(deck []string) *wr.Chooser

func DeckTryParse

func DeckTryParse(d *Dice, fn string)

func DecksDetect

func DecksDetect(d *Dice)

DecksDetect 检查牌堆

func DiceDCRoll

func DiceDCRoll(addLine int64, pool int64, points int64) (int64, int64, int64, []string)

func DiceFormat

func DiceFormat(ctx *MsgContext, s string) string

func DiceFormatTmpl

func DiceFormatTmpl(ctx *MsgContext, s string) string

func DiceRoll

func DiceRoll(dicePoints int) int

func DiceRoll64

func DiceRoll64(dicePoints int64) int64

func DiceWodRoll

func DiceWodRoll(addLine int64, pool int64, points int64, threshold int64, isGE bool) (int64, int64, int64, []string)

func ErrorLogAndContinue

func ErrorLogAndContinue(d *Dice)

func ExtractDingTalkGroupID

func ExtractDingTalkGroupID(id string) string

func ExtractDingTalkUserID

func ExtractDingTalkUserID(id string) string

func ExtractDiscordChannelID

func ExtractDiscordChannelID(id string) string

func ExtractDiscordUserID

func ExtractDiscordUserID(id string) string

func ExtractDodoGroupID

func ExtractDodoGroupID(id string) string

func ExtractDodoUserID

func ExtractDodoUserID(id string) string

func ExtractKookChannelID

func ExtractKookChannelID(id string) string

func ExtractKookGuildID

func ExtractKookGuildID(id string) string

func ExtractKookUserID

func ExtractKookUserID(id string) string

func ExtractMCUserID

func ExtractMCUserID(id string) string

func ExtractSealChatPrivateChatID

func ExtractSealChatPrivateChatID(id string, userId string) string

func ExtractSealChatUserID

func ExtractSealChatUserID(id string) string

func ExtractSlackChannelID

func ExtractSlackChannelID(id string) string

func ExtractSlackUserID

func ExtractSlackUserID(id string) string

func ExtractTelegramGroupID

func ExtractTelegramGroupID(id string) string

func ExtractTelegramUserID

func ExtractTelegramUserID(id string) string

func FilenameReplace

func FilenameReplace(name string) string

func FormatDiceID

func FormatDiceID(ctx *MsgContext, id interface{}, isGroup bool) string

func FormatDiceIDDingTalk

func FormatDiceIDDingTalk(diceDingTalk string) string

func FormatDiceIDDingTalkGroup

func FormatDiceIDDingTalkGroup(diceDingTalk string) string

func FormatDiceIDDiscord

func FormatDiceIDDiscord(diceDiscord string) string

func FormatDiceIDDiscordChannel

func FormatDiceIDDiscordChannel(diceDiscord string) string

func FormatDiceIDDiscordGuild

func FormatDiceIDDiscordGuild(diceDiscord string) string

func FormatDiceIDDodo

func FormatDiceIDDodo(sourceid string) string

func FormatDiceIDDodoGroup

func FormatDiceIDDodoGroup(channelid string) string

func FormatDiceIDKook

func FormatDiceIDKook(diceKook string) string

func FormatDiceIDKookChannel

func FormatDiceIDKookChannel(diceKook string) string

func FormatDiceIDKookGuild

func FormatDiceIDKookGuild(diceKook string) string

func FormatDiceIDMC

func FormatDiceIDMC(diceMC string) string

func FormatDiceIDQQ

func FormatDiceIDQQ(diceQQ string) string

func FormatDiceIDQQCh

func FormatDiceIDQQCh(userID string) string

func FormatDiceIDQQChGroup

func FormatDiceIDQQChGroup(guildID, channelID string) string

func FormatDiceIDQQGroup

func FormatDiceIDQQGroup(diceQQ string) string

func FormatDiceIDQQGroupV12

func FormatDiceIDQQGroupV12(diceWalleQ string) string

FormatDiceIDQQGroupV12 QQ-Group:122

func FormatDiceIDQQV12

func FormatDiceIDQQV12(diceWalleQ string) string

FormatDiceIDQQV12 QQ:122

func FormatDiceIDSealChat

func FormatDiceIDSealChat(id string) string

func FormatDiceIDSealChatGroup

func FormatDiceIDSealChatGroup(id string) string

func FormatDiceIDSealChatPrivate

func FormatDiceIDSealChatPrivate(id string) string

func FormatDiceIDSlack

func FormatDiceIDSlack(id string) string

func FormatDiceIDSlackChannel

func FormatDiceIDSlackChannel(id string) string

func FormatDiceIDSlackGuild

func FormatDiceIDSlackGuild(id string) string

func FormatDiceIDTelegram

func FormatDiceIDTelegram(diceTg string) string

func FormatDiceIDTelegramGroup

func FormatDiceIDTelegramGroup(diceTg string) string

func GenerateConfig

func GenerateConfig(qq int64, port int, info GoCqhttpLoginInfo) string

func GenerateDeviceJSON

func GenerateDeviceJSON(dice *Dice, protocol int) (string, []byte, error)

func GenerateDeviceJSONAllRandom

func GenerateDeviceJSONAllRandom(protocol int) (string, []byte, error)

func GenerateDeviceJSONAndroid

func GenerateDeviceJSONAndroid(dice *Dice, protocol int) (string, []byte, error)

func GenerateDeviceJSONAndroidWatch

func GenerateDeviceJSONAndroidWatch(protocol int) (string, []byte, error)

func GenerateDeviceJSONIos

func GenerateDeviceJSONIos(protocol int) (string, []byte, error)

func GenerateLagrangeConfig

func GenerateLagrangeConfig(port int, info *EndPointInfo) string

func GenerateVerificationCode

func GenerateVerificationCode(platform string, userID string, username string, useBase64 bool) string

GenerateVerificationCode 生成海豹校验码

func GetCloudContent

func GetCloudContent(urls []string, etag string) (int, []byte, error)

func GetExtensionDesc

func GetExtensionDesc(ei *ExtInfo) string

func GetLogTxt

func GetLogTxt(ctx *MsgContext, groupID string, logName string, fileNamePrefix string) (*os.File, error)

func GetPlayerInfoBySender

func GetPlayerInfoBySender(ctx *MsgContext, msg *Message) (*GroupInfo, *GroupPlayerInfo)

GetPlayerInfoBySender 获取玩家群内信息,没有就创建

func GetRandomFreePort

func GetRandomFreePort() (int, error)

func GetResultText

func GetResultText(ctx *MsgContext, successRank int, userShortVersion bool) string

func GetResultTextWithRequire

func GetResultTextWithRequire(ctx *MsgContext, successRank int, difficultyRequire int, userShortVersion bool) string

func GetValueNameByAlias

func GetValueNameByAlias(s string, alias map[string][]string) string

func GoCqhttpServe

func GoCqhttpServe(dice *Dice, conn *EndPointInfo, loginInfo GoCqhttpLoginInfo)

func GoCqhttpServeRemoveSessionToken

func GoCqhttpServeRemoveSessionToken(dice *Dice, conn *EndPointInfo)

func ImageRewrite

func ImageRewrite(longText string, solve func(text string) string) string

func IsCurGroupBotOnByID

func IsCurGroupBotOnByID(session *IMSession, ep *EndPointInfo, messageType string, groupID string) bool

func JSONNumberUnmarshal

func JSONNumberUnmarshal(data []byte, v interface{}) error

func JSONValueMapUnmarshal

func JSONValueMapUnmarshal(data []byte, v *map[string]*VMValue) error

func JsDelete

func JsDelete(_ *Dice, jsInfo *JsScriptInfo)

func JsDisable

func JsDisable(d *Dice, jsInfoName string)

func JsEnable

func JsEnable(d *Dice, jsInfoName string)

func LagrangeServe

func LagrangeServe(dice *Dice, conn *EndPointInfo, loginInfo GoCqhttpLoginInfo)

func LagrangeServeRemoveSession

func LagrangeServeRemoveSession(dice *Dice, conn *EndPointInfo)

func LockFreeMapToMap

func LockFreeMapToMap(m lockfree.HashMap) map[string]interface{}

func LogAppend

func LogAppend(ctx *MsgContext, groupID string, logName string, logItem *model.LogOneItem) bool

func LogDeleteByID

func LogDeleteByID(ctx *MsgContext, groupID string, logName string, messageID interface{}) bool

func LogEditByID

func LogEditByID(ctx *MsgContext, groupID, logName, content string, messageID interface{}) bool

LogEditByID finds the log item under logName with messageID and replace it with content. If the log item cannot be found or an error happens, it returns false.

func LogRollBriefByPC

func LogRollBriefByPC(ctx *MsgContext, items []*model.LogOneItem, showAll bool, name string) string

LogRollBriefByPC 根据log生成骰点简报

func LogRollBriefDetail

func LogRollBriefDetail(items []*model.LogOneItem) []string

LogRollBriefDetail 根据log生成骰点简报

func LogSendToBackend

func LogSendToBackend(ctx *MsgContext, groupID string, logName string) (bool, string, error)

func MemberBan

func MemberBan(ctx *MsgContext, groupID string, userID string, duration int64)

func MemberKick

func MemberKick(ctx *MsgContext, groupID string, userID string)

func MessageSegmentToText

func MessageSegmentToText(ms []MessageSegment) string

func OneBot11CqMessageToArrayMessage

func OneBot11CqMessageToArrayMessage(longText string) []interface{}

func Pretty

func Pretty(pretty bool) func(*DiceRollParser) error

func RandString

func RandString(n int) string

func RandStringBytesMaskImprSrcSB

func RandStringBytesMaskImprSrcSB(n int) string

func RandStringBytesMaskImprSrcSB2

func RandStringBytesMaskImprSrcSB2(n int) string

func ReadCardType

func ReadCardType(mctx *MsgContext) string

func ReadCardTypeEx

func ReadCardTypeEx(mctx *MsgContext, curType string) string

func RegisterBuiltinExtCoc7

func RegisterBuiltinExtCoc7(self *Dice)

func RegisterBuiltinExtDeck

func RegisterBuiltinExtDeck(d *Dice)

func RegisterBuiltinExtDnd5e

func RegisterBuiltinExtDnd5e(self *Dice)

func RegisterBuiltinExtExp

func RegisterBuiltinExtExp(_ *Dice)

func RegisterBuiltinExtFun

func RegisterBuiltinExtFun(self *Dice)

func RegisterBuiltinExtLog

func RegisterBuiltinExtLog(self *Dice)

func RegisterBuiltinExtReply

func RegisterBuiltinExtReply(dice *Dice)

func RegisterBuiltinExtTemple

func RegisterBuiltinExtTemple(dice *Dice)

func RegisterBuiltinStory

func RegisterBuiltinStory(self *Dice)

func RemoveSpace

func RemoveSpace(s string) string

func ReplyGroup

func ReplyGroup(ctx *MsgContext, msg *Message, text string)

func ReplyGroupRaw

func ReplyGroupRaw(ctx *MsgContext, msg *Message, text string, flag string)

func ReplyPerson

func ReplyPerson(ctx *MsgContext, msg *Message, text string)

func ReplyPersonRaw

func ReplyPersonRaw(ctx *MsgContext, msg *Message, text string, flag string)

func ReplyReload

func ReplyReload(dice *Dice)

func ReplyToSender

func ReplyToSender(ctx *MsgContext, msg *Message, text string)

func ReplyToSenderNoCheck

func ReplyToSenderNoCheck(ctx *MsgContext, msg *Message, text string)

func ReplyToSenderRaw

func ReplyToSenderRaw(ctx *MsgContext, msg *Message, text string, flag string)

func ResultCheck

func ResultCheck(ctx *MsgContext, cocRule int, d100 int64, attrValue int64, difficultyRequired int) (successRank int, criticalSuccessValue int64)

func ResultCheckBase

func ResultCheckBase(cocRule int, d100 int64, attrValue int64, difficultyRequired int) (successRank int, criticalSuccessValue int64)

大失败:骰出 100。若成功需要的值低于 50,大于等于 96 的结果都是大失败 -> -2 失败:骰出大于角色技能或属性值(但不是大失败) -> -1 常规成功:骰出小于等于角色技能或属性值 -> 1 困难成功:骰出小于等于角色技能或属性值的一半 -> 2 极难成功:骰出小于等于角色技能或属性值的五分之一 -> 3 大成功:骰出1 -> 4

func SendFileToGroupRaw

func SendFileToGroupRaw(ctx *MsgContext, msg *Message, path string, flag string)

func SendFileToPersonRaw

func SendFileToPersonRaw(ctx *MsgContext, msg *Message, path string, flag string)

func SendFileToSenderRaw

func SendFileToSenderRaw(ctx *MsgContext, msg *Message, path string, flag string)

func ServeDingTalk

func ServeDingTalk(d *Dice, ep *EndPointInfo)

func ServeDiscord

func ServeDiscord(d *Dice, ep *EndPointInfo)

ServeDiscord gocqhttp_helper 中有一个相同的待重构方法,为了避免阻碍重构,先不写在一起了

func ServeDodo

func ServeDodo(d *Dice, ep *EndPointInfo)

func ServeKook

func ServeKook(d *Dice, ep *EndPointInfo)

func ServeMinecraft

func ServeMinecraft(d *Dice, ep *EndPointInfo)

func ServeQQ

func ServeQQ(d *Dice, ep *EndPointInfo)

func ServeRed

func ServeRed(d *Dice, ep *EndPointInfo)

func ServeSatori

func ServeSatori(d *Dice, ep *EndPointInfo)

func ServeSealChat

func ServeSealChat(d *Dice, ep *EndPointInfo)

func ServeSlack

func ServeSlack(d *Dice, ep *EndPointInfo)

func ServeTelegram

func ServeTelegram(d *Dice, ep *EndPointInfo)

func ServerOfficialQQ

func ServerOfficialQQ(d *Dice, ep *EndPointInfo)

func SetBotOffAtGroup

func SetBotOffAtGroup(ctx *MsgContext, groupID string)

func SetCardType

func SetCardType(mctx *MsgContext, curType string)

func SetPlayerGroupCardByTemplate

func SetPlayerGroupCardByTemplate(ctx *MsgContext, tmpl string) (string, error)

func SetTempVars

func SetTempVars(ctx *MsgContext, qqNickname string)

func SetupTextHelpInfo

func SetupTextHelpInfo(d *Dice, helpInfo TextTemplateWithHelpDict, texts TextTemplateWithWeightDict, fn string)

func Size

func Size(size int) func(*DiceRollParser) error

func SpecialExecuteTimesParse

func SpecialExecuteTimesParse(cmd string) (string, int)

func StoryLogBackupBatchDelete

func StoryLogBackupBatchDelete(d *Dice, backups []string) []string

func StoryLogBackupDownloadPath

func StoryLogBackupDownloadPath(d *Dice, backup string) (string, error)

func TryGetBackendURL

func TryGetBackendURL()

func UserIDExtract

func UserIDExtract(uid string) string

func VarDelValue

func VarDelValue(ctx *MsgContext, s string)

func VarGetValueInt64

func VarGetValueInt64(ctx *MsgContext, s string) (int64, bool)

func VarGetValueStr

func VarGetValueStr(ctx *MsgContext, s string) (string, bool)

func VarSetValue

func VarSetValue(ctx *MsgContext, s string, v *VMValue)

func VarSetValueDNDComputed

func VarSetValueDNDComputed(ctx *MsgContext, s string, val int64, expr string)

func VarSetValueInt64

func VarSetValueInt64(ctx *MsgContext, s string, v int64)

func VarSetValueStr

func VarSetValueStr(ctx *MsgContext, s string, v string)

func WalleQServe

func WalleQServe(dice *Dice, conn *EndPointInfo, password string, protocol int, isAsyncRun bool)

func WalleQServeProcessKill

func WalleQServeProcessKill(dice *Dice, conn *EndPointInfo)

func WalleQServeRemoveSessionToken

func WalleQServeRemoveSessionToken(dice *Dice, conn *EndPointInfo)

Types

type AddDiscordEcho

type AddDiscordEcho struct {
	Token              string
	ProxyURL           string
	ReverseProxyUrl    string
	ReverseProxyCDNUrl string
}

type AdvancedConfig

type AdvancedConfig struct {
	Show   bool `json:"show" yaml:"show"`     // 显示高级设置页
	Enable bool `json:"enable" yaml:"enable"` // 启用高级设置

	StoryLogBackendUrl   string `json:"storyLogBackendUrl" yaml:"storyLogBackendUrl"`     // 自定义后端地址
	StoryLogApiVersion   string `json:"storyLogApiVersion" yaml:"storyLogApiVersion"`     // 后端 api 版本
	StoryLogBackendToken string `json:"storyLogBackendToken" yaml:"storyLogBackendToken"` // 自定义后端 token
}

type AtInfo

type AtInfo struct {
	UserID string `json:"userId" jsbind:"userId"`
}

[CQ:at,qq=22]

func AtParse

func AtParse(cmd string, prefix string) (string, []*AtInfo)

func (*AtInfo) CopyCtx

func (i *AtInfo) CopyCtx(ctx *MsgContext) (*MsgContext, bool)

type AttrConfig

type AttrConfig struct {
	Display string `yaml:"display" json:"display"` // 展示形式,即st show时格式,默认为顺序展示

	Top          []string          `yaml:"top,flow" json:"top,flow"`         //nolint
	SortBy       string            `yaml:"sortBy" json:"sortBy"`             // time | Name | value desc
	Ignores      []string          `yaml:"ignores" json:"ignores"`           // 这里面的属性将不被显示
	ShowAs       map[string]string `yaml:"showAs" json:"showAs"`             // 展示形式,即st show时格式
	Setter       map[string]string `yaml:"setter" json:"setter"`             // st写入时执行这个,未实装
	ItemsPerLine int               `yaml:"itemsPerLine" json:"itemsPerLine"` // 每行显示几个属性,默认4
}

type AttributeConfigs

type AttributeConfigs struct {
	Alias map[string][]string `yaml:"alias"`
	Order AttributeOrder      `yaml:"order"`
}

type AttributeOrder

type AttributeOrder struct {
	Top    []string             `yaml:"top,flow"`
	Others AttributeOrderOthers `yaml:"others"`
}

type AttributeOrderOthers

type AttributeOrderOthers struct {
	SortBy string `yaml:"sortBy"` // time | Name | value desc
}

type BackupCleanStrategy

type BackupCleanStrategy int
const (
	BackupCleanStrategyDisabled BackupCleanStrategy = iota
	BackupCleanStrategyByCount
	BackupCleanStrategyByTime
)

type BackupCleanTrigger

type BackupCleanTrigger int
const (
	// BackupCleanTriggerCron 通过独立定时任务触发
	BackupCleanTriggerCron BackupCleanTrigger = 1 << iota
	// BackupCleanTriggerRotate 通过自动备份触发
	BackupCleanTriggerRotate
)

type BackupSelection

type BackupSelection uint64
const (
	BackupSelectionJS BackupSelection = 1 << iota
	BackupSelectionDecks
	BackupSelectionHelpDoc
	BackupSelectionCensor
	BackupSelectionNames
	BackupSelectionImages

	BackupSelectionBasic     BackupSelection = 0
	BackupSelectionResources BackupSelection = BackupSelectionImages
	BackupSelectionAll       BackupSelection = BackupSelectionBasic |
		BackupSelectionJS |
		BackupSelectionDecks |
		BackupSelectionHelpDoc |
		BackupSelectionCensor |
		BackupSelectionNames |
		BackupSelectionResources
)

type BanListInfo

type BanListInfo struct {
	Parent                          *Dice                              `yaml:"-" json:"-"`
	Map                             *SyncMap[string, *BanListInfoItem] `yaml:"-" json:"-"`
	BanBehaviorRefuseReply          bool                               `yaml:"banBehaviorRefuseReply" json:"banBehaviorRefuseReply"`                   // 拉黑行为: 拒绝回复
	BanBehaviorRefuseInvite         bool                               `yaml:"banBehaviorRefuseInvite" json:"banBehaviorRefuseInvite"`                 // 拉黑行为: 拒绝邀请
	BanBehaviorQuitLastPlace        bool                               `yaml:"banBehaviorQuitLastPlace" json:"banBehaviorQuitLastPlace"`               // 拉黑行为: 退出事发群
	BanBehaviorQuitPlaceImmediately bool                               `yaml:"banBehaviorQuitPlaceImmediately" json:"banBehaviorQuitPlaceImmediately"` // 拉黑行为: 使用时立即退出群
	BanBehaviorQuitIfAdmin          bool                               `yaml:"banBehaviorQuitIfAdmin" json:"banBehaviorQuitIfAdmin"`                   // 拉黑行为: 邀请者以上权限使用时立即退群,否则发出警告信息
	ThresholdWarn                   int64                              `yaml:"thresholdWarn" json:"thresholdWarn"`                                     // 警告阈值
	ThresholdBan                    int64                              `yaml:"thresholdBan" json:"thresholdBan"`                                       // 错误阈值
	AutoBanMinutes                  int64                              `yaml:"autoBanMinutes" json:"autoBanMinutes"`                                   // 自动禁止时长

	ScoreReducePerMinute int64 `yaml:"scoreReducePerMinute" json:"scoreReducePerMinute"` // 每分钟下降
	ScoreGroupMuted      int64 `yaml:"scoreGroupMuted" json:"scoreGroupMuted"`           // 群组禁言
	ScoreGroupKicked     int64 `yaml:"scoreGroupKicked" json:"scoreGroupKicked"`         // 群组踢出
	ScoreTooManyCommand  int64 `yaml:"scoreTooManyCommand" json:"scoreTooManyCommand"`   // 刷指令

	JointScorePercentOfGroup   float64 `yaml:"jointScorePercentOfGroup" json:"jointScorePercentOfGroup"`     // 群组连带责任
	JointScorePercentOfInviter float64 `yaml:"jointScorePercentOfInviter" json:"jointScorePercentOfInviter"` // 邀请人连带责任
	// contains filtered or unexported fields
}

func (*BanListInfo) AddScoreBase

func (i *BanListInfo) AddScoreBase(uid string, score int64, place string, reason string, ctx *MsgContext) *BanListInfoItem

AddScoreBase 这一份ctx有endpoint就行

func (*BanListInfo) AddScoreByCensor

func (i *BanListInfo) AddScoreByCensor(uid string, score int64, place string, level string, ctx *MsgContext)

AddScoreByCensor 敏感词审查

func (*BanListInfo) AddScoreByCommandSpam

func (i *BanListInfo) AddScoreByCommandSpam(uid string, place string, ctx *MsgContext)

AddScoreByCommandSpam 指令刷屏

func (*BanListInfo) AddScoreByGroupKicked

func (i *BanListInfo) AddScoreByGroupKicked(uid string, place string, ctx *MsgContext)

AddScoreByGroupKicked 群组踢出

func (*BanListInfo) AddScoreByGroupMuted

func (i *BanListInfo) AddScoreByGroupMuted(uid string, place string, ctx *MsgContext)

AddScoreByGroupMuted 群组禁言

func (*BanListInfo) AfterLoads

func (i *BanListInfo) AfterLoads()

func (*BanListInfo) DeleteByID

func (i *BanListInfo) DeleteByID(d *Dice, id string)

func (*BanListInfo) GetByID

func (i *BanListInfo) GetByID(uid string) (*BanListInfoItem, bool)

func (*BanListInfo) Init

func (i *BanListInfo) Init()

func (*BanListInfo) Loads

func (i *BanListInfo) Loads()

func (*BanListInfo) NoticeCheck

func (i *BanListInfo) NoticeCheck(uid string, place string, oldRank BanRankType, ctx *MsgContext) BanRankType

func (*BanListInfo) NoticeCheckPrepare

func (i *BanListInfo) NoticeCheckPrepare(uid string) BanRankType

func (*BanListInfo) SaveChanged

func (i *BanListInfo) SaveChanged(d *Dice)

func (*BanListInfo) SetTrustByID

func (i *BanListInfo) SetTrustByID(uid string, place string, reason string)

type BanListInfoItem

type BanListInfoItem struct {
	ID      string      `json:"ID" jsbind:"id"`
	Name    string      `json:"name" jsbind:"name"`
	Score   int64       `json:"score" jsbind:"score"`     // 怒气值
	Rank    BanRankType `json:"rank" jsbind:"rank"`       // 0 没事 -10警告 -30禁止 30信任
	Times   []int64     `json:"times" jsbind:"times"`     // 事发时间
	Reasons []string    `json:"reasons" jsbind:"reasons"` // 拉黑原因
	Places  []string    `json:"places" jsbind:"places"`   // 发生地点
	BanTime int64       `json:"banTime" jsbind:"banTime"` // 上黑名单时间

	BanUpdatedAt int64 `json:"-"` // 排序依据,不过可能和bantime重复?
	UpdatedAt    int64 `json:"-"` // 数据更新时间
}

type BanRankType

type BanRankType int
const (
	BanRankBanned  BanRankType = -30
	BanRankWarn    BanRankType = -10
	BanRankNormal  BanRankType = 0
	BanRankTrusted BanRankType = 30
)

type Bot

type Bot struct {
	Self   Self `json:"self"`
	Online bool `json:"online"`
}

type BotInfo

type BotInfo struct {
	SelfId string
	Name   string
}

type ByLength

type ByLength []string

func (ByLength) Len

func (s ByLength) Len() int

func (ByLength) Less

func (s ByLength) Less(i, j int) bool

func (ByLength) Swap

func (s ByLength) Swap(i, j int)

type ByRIListValue

type ByRIListValue []*RIListItem

func (ByRIListValue) Len

func (lst ByRIListValue) Len() int

func (ByRIListValue) Less

func (lst ByRIListValue) Less(i, j int) bool

func (ByRIListValue) Swap

func (lst ByRIListValue) Swap(i, j int)

type ByteCode

type ByteCode struct {
	T        Type
	Value    int64
	ValueStr string
	ValueAny interface{}
}

func (*ByteCode) CodeString

func (code *ByteCode) CodeString() string

func (*ByteCode) String

func (code *ByteCode) String() string

type CQCommand

type CQCommand struct {
	Type      string
	Args      map[string]string
	Overwrite string
}

func CQParse

func CQParse(cmd string) *CQCommand

func (*CQCommand) Compile

func (c *CQCommand) Compile() string

type CardMessage

type CardMessage struct {
	Type    string        `json:"type"`
	Modules []interface{} `json:"modules"`
	Theme   string        `json:"theme"`
	Size    string        `json:"size"`
}

type CardMessageModuleFile

type CardMessageModuleFile struct {
	Type  string `json:"type"`
	Title string `json:"title"`
	Src   string `json:"src"`
}

type CardMessageModuleImage

type CardMessageModuleImage struct {
	Type     string `json:"type"`
	Elements []struct {
		Type string `json:"type"`
		Src  string `json:"src"`
	} `json:"elements"`
}

type CardMessageModuleText

type CardMessageModuleText struct {
	Type string `json:"type"`
	Text struct {
		Content string `json:"content"`
		Type    string `json:"type"`
	} `json:"text"`
}

type CensorHandler

type CensorHandler int
const (
	// SendWarning 发送警告
	SendWarning CensorHandler = iota
	// SendNotice 向通知列表/邮件发送通知
	SendNotice
	// BanUser 拉黑用户
	BanUser
	// BanGroup 拉黑群
	BanGroup
	// BanInviter 拉黑邀请人
	BanInviter
	// AddScore 增加怒气值
	AddScore
)

type CensorManager

type CensorManager struct {
	IsLoading           bool
	Parent              *Dice
	Censor              *censor.Censor
	DB                  *sqlx.DB
	SensitiveWordsFiles map[string]*censor.WordFile
}

func (*CensorManager) Check

func (cm *CensorManager) Check(ctx *MsgContext, msg *Message, checkContent string) (*MsgCheckResult, error)

func (*CensorManager) DeleteCensorWordFiles

func (cm *CensorManager) DeleteCensorWordFiles(keys []string)

func (*CensorManager) Load

func (cm *CensorManager) Load(_ *Dice)

Load 审查加载

type CensorMode

type CensorMode int
const (
	OnlyOutputReply CensorMode = iota
	OnlyInputCommand
	AllInput
)

type CloudDeckItemInfo

type CloudDeckItemInfo struct {
	Distinct    bool
	OptionsUrls []string
}

type CmdArgs

type CmdArgs struct {
	Command                    string    `json:"command" jsbind:"command"`
	Args                       []string  `json:"args" jsbind:"args"`
	Kwargs                     []*Kwarg  `json:"kwargs" jsbind:"kwargs"`
	At                         []*AtInfo `json:"atInfo" jsbind:"at"`
	RawArgs                    string    `json:"rawArgs" jsbind:"rawArgs"`
	AmIBeMentioned             bool      `json:"amIBeMentioned" jsbind:"amIBeMentioned"`
	AmIBeMentionedFirst        bool      `json:"amIBeMentionedFirst" jsbind:"amIBeMentionedFirst"` // 同上,但要求是第一个被@的
	SomeoneBeMentionedButNotMe bool      `json:"someoneBeMentionedButNotMe"`
	IsSpaceBeforeArgs          bool      `json:"isSpaceBeforeArgs"`     // 命令前面是否有空格,用于区分rd20和rd 20
	CleanArgs                  string    `jsbind:"cleanArgs"`           // 一种格式化后的参数,也就是中间所有分隔符都用一个空格替代
	SpecialExecuteTimes        int       `jsbind:"specialExecuteTimes"` // 特殊的执行次数,对应 3# 这种
	RawText                    string    `jsbind:"rawText"`             // 原始命令

	MentionedOtherDice bool   // 似乎没有在用
	CleanArgsChopRest  string // 未来可能移除
	// contains filtered or unexported fields
}

func ArgsParse

func ArgsParse(rawCmd string) *CmdArgs

func CommandParse

func CommandParse(rawCmd string, currentCmdLst []string, prefix []string, platformPrefix string, isParseExecuteTimes bool) *CmdArgs

func CommandParseNew

func CommandParseNew(ctx *MsgContext, msg *Message) *CmdArgs

func (*CmdArgs) ChopPrefixToArgsWith

func (cmdArgs *CmdArgs) ChopPrefixToArgsWith(ss ...string) bool

func (*CmdArgs) EatPrefixWith

func (cmdArgs *CmdArgs) EatPrefixWith(ss ...string) (string, bool)

func (*CmdArgs) GetArgN

func (cmdArgs *CmdArgs) GetArgN(n int) string

func (*CmdArgs) GetKwarg

func (cmdArgs *CmdArgs) GetKwarg(s string) *Kwarg

func (*CmdArgs) GetRestArgsFrom

func (cmdArgs *CmdArgs) GetRestArgsFrom(index int) string

func (*CmdArgs) IsArgEqual

func (cmdArgs *CmdArgs) IsArgEqual(n int, ss ...string) bool

* 检查第N项参数是否为某个字符串,n从1开始,若没有第n项参数也视为失败

func (*CmdArgs) RevokeExecuteTimesParse

func (cmdArgs *CmdArgs) RevokeExecuteTimesParse()

func (*CmdArgs) SetupAtInfo

func (cmdArgs *CmdArgs) SetupAtInfo(uid string)

type CmdExecuteResult

type CmdExecuteResult struct {
	Matched  bool // 是否是指令
	Solved   bool `jsbind:"solved"` // 是否响应此指令
	ShowHelp bool `jsbind:"showHelp"`
}

type CmdItemInfo

type CmdItemInfo struct {
	Name                    string                    `jsbind:"name"`
	ShortHelp               string                    // 短帮助,格式是 .xxx a b // 说明
	Help                    string                    `jsbind:"help"`                    // 长帮助,带换行的较详细说明
	HelpFunc                func(isShort bool) string `jsbind:"helpFunc"`                // 函数形式帮助,存在时优先于其他
	AllowDelegate           bool                      `jsbind:"allowDelegate"`           // 允许代骰
	DisabledInPrivate       bool                      `jsbind:"disabledInPrivate"`       // 私聊不可用
	EnableExecuteTimesParse bool                      `jsbind:"enableExecuteTimesParse"` // 启用执行次数解析,也就是解析3#这样的文本

	IsJsSolveFunc bool
	Solve         func(ctx *MsgContext, msg *Message, cmdArgs *CmdArgs) CmdExecuteResult `jsbind:"solve"`

	Raw                bool `jsbind:"raw"`                // 高级模式。默认模式下行为是:需要在当前群/私聊开启,或@自己时生效(需要为第一个@目标)
	CheckCurrentBotOn  bool `jsbind:"checkCurrentBotOn"`  // 是否检查当前可用状况,包括群内可用和是私聊两种方式,如失败不进入solve
	CheckMentionOthers bool `jsbind:"checkMentionOthers"` // 是否检查@了别的骰子,如失败不进入solve
}

type CmdMapCls

type CmdMapCls map[string]*CmdItemInfo

type CnmodsDetailInfo

type CnmodsDetailInfo struct {
	Code      int   `json:"code"`
	Timestamp int64 `json:"timestamp"`
	Data      struct {
		Module struct {
			KeyID           int    `json:"keyId"`
			CreateTime      string `json:"createTime"`
			Sort            int    `json:"sort"`
			Title           string `json:"title"`
			ReleaseDate     string `json:"releaseDate"`
			ModuleType      string `json:"moduleType"`
			ModuleVersion   string `json:"moduleVersion"`
			ModuleAge       string `json:"moduleAge"`
			FreeLevel       string `json:"freeLevel"`
			OccurrencePlace string `json:"occurrencePlace"`
			Structure       string `json:"structure"`
			MinDuration     int    `json:"minDuration"`
			MaxDuration     int    `json:"maxDuration"`
			MinAmount       int    `json:"minAmount"`
			MaxAmount       int    `json:"maxAmount"`
			Article         string `json:"article"`
			URL             string `json:"url"`
			Email           string `json:"email"`
			Command         bool   `json:"command"`
			Opinion         string `json:"opinion"`
			Original        bool   `json:"original"`
			Qq              string `json:"qq"`
			CustomerID      int    `json:"customerId"`
			OpenComment     bool   `json:"openComment"`
			Open            bool   `json:"open"`
		} `json:"module"`
		ModuleToLabelList []interface{} `json:"moduleToLabelList"`
		RelatedModuleList []interface{} `json:"relatedModuleList"`
		RecommendList     []struct {
			KeyID      int    `json:"keyId"`
			CreateTime string `json:"createTime"`
			Sort       int    `json:"sort"`
			Content    string `json:"content"`
			LoginUser  struct {
				KeyID      int    `json:"keyId"`
				CreateTime string `json:"createTime"`
				Sort       int    `json:"sort"`
				LoginID    string `json:"loginId"`
				Password   string `json:"password"`
				NickName   string `json:"nickName"`
			} `json:"loginUser"`
			Module struct {
				KeyID           int    `json:"keyId"`
				CreateTime      string `json:"createTime"`
				Sort            int    `json:"sort"`
				Title           string `json:"title"`
				ReleaseDate     string `json:"releaseDate"`
				ModuleType      string `json:"moduleType"`
				ModuleVersion   string `json:"moduleVersion"`
				ModuleAge       string `json:"moduleAge"`
				FreeLevel       string `json:"freeLevel"`
				OccurrencePlace string `json:"occurrencePlace"`
				Structure       string `json:"structure"`
				MinDuration     int    `json:"minDuration"`
				MaxDuration     int    `json:"maxDuration"`
				MinAmount       int    `json:"minAmount"`
				MaxAmount       int    `json:"maxAmount"`
				Article         string `json:"article"`
				URL             string `json:"url"`
				Email           string `json:"email"`
				Command         bool   `json:"command"`
				Opinion         string `json:"opinion"`
				Original        bool   `json:"original"`
				Qq              string `json:"qq"`
				CustomerID      int    `json:"customerId"`
				OpenComment     bool   `json:"openComment"`
				Open            bool   `json:"open"`
			} `json:"module"`
		} `json:"recommendList"`
		Collect bool   `json:"collect"`
		HeadPic string `json:"headPic"`
	} `json:"data"`
}

func CnmodsDetail

func CnmodsDetail(keyID string) *CnmodsDetailInfo

type CnmodsSearchResult

type CnmodsSearchResult struct {
	Code      int   `json:"code"`
	Timestamp int64 `json:"timestamp"`
	Data      struct {
		List []struct {
			Qq              string `json:"qq"`
			MinAmount       int    `json:"minAmount"`
			MinDuration     int    `json:"minDuration"`
			Original        bool   `json:"original"`
			ModuleType      string `json:"moduleType"`
			ReleaseDate     string `json:"releaseDate"`
			KeyID           int    `json:"keyId"`
			Sort            int    `json:"sort"`
			Title           string `json:"title"`
			Structure       string `json:"structure"`
			Article         string `json:"article"`
			URL             string `json:"url"`
			ModuleAge       string `json:"moduleAge"`
			FreeLevel       string `json:"freeLevel"`
			Opinion         string `json:"opinion"`
			UpdateLastWeek  bool   `json:"updateLastWeek"`
			ModuleVersion   string `json:"moduleVersion"`
			OccurrencePlace string `json:"occurrencePlace"`
			MaxAmount       int    `json:"maxAmount"`
			MaxDuration     int    `json:"maxDuration"`
			Email           string `json:"email"`
		} `json:"list"`
		TotalElements int `json:"totalElements"`
		TotalPages    int `json:"totalPages"`
	} `json:"data"`
}

func CnmodsSearch

func CnmodsSearch(title string, page int, pageSize int, isRec bool, article string) (CnmodsSearchResult, error)

type CocRuleCheckRet

type CocRuleCheckRet struct {
	SuccessRank          int   `jsbind:"successRank"`          // 成功级别
	CriticalSuccessValue int64 `jsbind:"criticalSuccessValue"` // 大成功数值
}

type CocRuleInfo

type CocRuleInfo struct {
	Index int    `jsbind:"index"` // 序号
	Key   string `jsbind:"key"`   // .setcoc key
	Name  string `jsbind:"name"`  // 已切换至规则 Name: Desc
	Desc  string `jsbind:"desc"`  // 规则描述

	Check func(ctx *MsgContext, d100 int64, checkValue int64, difficultyRequired int) CocRuleCheckRet `jsbind:"check"`
}

type ComputedData

type ComputedData struct {
	Expr string `json:"expr"`

	/* 缓存数据 */
	Attrs *SyncMap[string, *VMValue] `json:"-"`
}

type ConfigItem

type ConfigItem struct {
	Key          string      `json:"key" jsbind:"key"`
	Type         string      `json:"type" jsbind:"type"`
	DefaultValue interface{} `json:"defaultValue" jsbind:"defaultValue"`
	Value        interface{} `json:"value,omitempty" jsbind:"value"`
	Option       interface{} `json:"option,omitempty" jsbind:"option"`
	Deprecated   bool        `json:"deprecated,omitempty" jsbind:"deprecated"`

	Description string `json:"description" jsbind:"description"`
}

ConfigItem 供插件使用的配置项

type ConfigManager

type ConfigManager struct {
	Plugins map[string]*PluginConfig
	// contains filtered or unexported fields
}

func NewConfigManager

func NewConfigManager(filename string) *ConfigManager

func (*ConfigManager) Load

func (cm *ConfigManager) Load() error

func (*ConfigManager) NewConfigItem

func (cm *ConfigManager) NewConfigItem(key string, defaultValue interface{}, description string) *ConfigItem

func (*ConfigManager) RegisterPluginConfig

func (cm *ConfigManager) RegisterPluginConfig(pluginName string, configItems ...*ConfigItem)

func (*ConfigManager) ResetConfigToDefault

func (cm *ConfigManager) ResetConfigToDefault(pluginName, key string)

func (*ConfigManager) SetConfig

func (cm *ConfigManager) SetConfig(pluginName, key string, value interface{})

func (*ConfigManager) UnregisterConfig

func (cm *ConfigManager) UnregisterConfig(pluginName string, keys ...string)

type ConsoleWriterShutUp

type ConsoleWriterShutUp struct {
	*log.ConsoleWriter
}

ConsoleWriterShutUp Kook go的作者要求必须使用他们自己的logger用于构造Intent Session,并且该logger不可缺省,因此这里重新实现一个不干活的logger以保证控制台log的干净整洁

func (*ConsoleWriterShutUp) Close

func (c *ConsoleWriterShutUp) Close() (err error)

func (*ConsoleWriterShutUp) WriteEntry

func (c *ConsoleWriterShutUp) WriteEntry(_ *log.Entry) (int, error)

type DeckCommandListItem

type DeckCommandListItem struct {
	// contains filtered or unexported fields
}

type DeckCommandListItems

type DeckCommandListItems []*DeckCommandListItem

func (DeckCommandListItems) Len

func (e DeckCommandListItems) Len() int

func (DeckCommandListItems) String

func (e DeckCommandListItems) String(i int) string

type DeckDiceEFormat

type DeckDiceEFormat struct {
	Title      []string `json:"_title"`
	Author     []string `json:"_author"`
	Date       []string `json:"_date"`
	UpdateDate []string `json:"_updateDate"`
	Brief      []string `json:"_brief"`
	Version    []string `json:"_version"`
	License    []string `json:"_license"`

	// 更新支持字段
	UpdateUrls []string `json:"_updateUrls"`
	Etag       []string `json:"_etag"`
}

type DeckInfo

type DeckInfo struct {
	Enable             bool                          `json:"enable" yaml:"enable"`
	ErrText            string                        `json:"errText" yaml:"errText"`
	Filename           string                        `json:"filename" yaml:"filename"`
	Format             string                        `json:"format" yaml:"format"`               // 几种:“SinaNya” ”Dice!“ "Seal"
	FormatVersion      int64                         `json:"formatVersion" yaml:"formatVersion"` // 格式版本,默认都是1
	FileFormat         string                        `json:"fileFormat" yaml:"-" `               // json / yaml / toml / jsonc
	Name               string                        `json:"name" yaml:"name"`
	Version            string                        `json:"version" yaml:"-"`
	Author             string                        `json:"author" yaml:"-"`
	License            string                        `json:"license" yaml:"-"` // 许可协议,如cc-by-nc等
	Command            map[string]bool               `json:"command" yaml:"-"` // 牌堆命令名
	DeckItems          map[string][]string           `yaml:"-" json:"-"`
	Date               string                        `json:"date" yaml:"-" `
	UpdateDate         string                        `json:"updateDate" yaml:"-" `
	Desc               string                        `yaml:"-" json:"desc"`
	Info               []string                      `yaml:"-" json:"-"`
	RawData            *map[string][]string          `yaml:"-" json:"-"`
	UpdateUrls         []string                      `yaml:"updateUrls" json:"updateUrls"`
	Etag               string                        `yaml:"etag" json:"etag"`
	Cloud              bool                          `yaml:"cloud" json:"cloud"` // 含有云端内容
	CloudDeckItemInfos map[string]*CloudDeckItemInfo `yaml:"-" json:"-"`
}

type DeckSealFormat

type DeckSealFormat struct {
	Meta  SealMeta            `toml:"meta"`
	Decks map[string][]string `toml:"decks"`
}

type DeckSinaNyaFormat

type DeckSinaNyaFormat struct {
	Name    string   `json:"name" yaml:"name"`
	Author  string   `json:"author" yaml:"author"`
	Version int      `json:"version" yaml:"version"`
	Command string   `json:"command" yaml:"command"`
	License string   `json:"license" yaml:"license"`
	Desc    string   `json:"desc" yaml:"desc"`
	Info    []string `json:"info" yaml:"info"`
	Default []string `json:"default" yaml:"default"`

	// 更新支持字段
	UpdateUrls []string `json:"update_urls"`
	Etag       string   `json:"etag"`
}

type Dice

type Dice struct {
	ImSession               *IMSession             `yaml:"imSession" jsbind:"imSession"`
	CmdMap                  CmdMapCls              `yaml:"-" json:"-"`
	ExtList                 []*ExtInfo             `yaml:"-"`
	RollParser              *DiceRollParser        `yaml:"-"`
	CommandCompatibleMode   bool                   `yaml:"commandCompatibleMode"`
	LastSavedTime           *time.Time             `yaml:"lastSavedTime"`
	LastUpdatedTime         int64                  `yaml:"-"`
	TextMap                 map[string]*wr.Chooser `yaml:"-"`
	BaseConfig              DiceConfig             `yaml:"-"`
	DBData                  *sqlx.DB               `yaml:"-"`                                    // 数据库对象
	DBLogs                  *sqlx.DB               `yaml:"-"`                                    // 数据库对象
	Logger                  *zap.SugaredLogger     `yaml:"-"`                                    // 日志
	LogWriter               *logger.WriterX        `yaml:"-"`                                    // 用于api的log对象
	IsDeckLoading           bool                   `yaml:"-"`                                    // 正在加载中
	DeckList                []*DeckInfo            `yaml:"deckList" jsbind:"deckList"`           // 牌堆信息
	CommandPrefix           []string               `yaml:"commandPrefix" jsbind:"commandPrefix"` // 指令前导
	DiceMasters             []string               `yaml:"diceMasters" jsbind:"diceMasters"`     // 骰主设置,需要格式: 平台:帐号
	NoticeIDs               []string               `yaml:"noticeIds"`                            // 通知ID
	OnlyLogCommandInGroup   bool                   `yaml:"onlyLogCommandInGroup"`                // 日志中仅记录命令
	OnlyLogCommandInPrivate bool                   `yaml:"onlyLogCommandInPrivate"`              // 日志中仅记录命令
	VersionCode             int                    `json:"versionCode"`                          // 版本ID(配置文件)
	MessageDelayRangeStart  float64                `yaml:"messageDelayRangeStart"`               // 指令延迟区间
	MessageDelayRangeEnd    float64                `yaml:"messageDelayRangeEnd"`
	WorkInQQChannel         bool                   `yaml:"workInQQChannel"`
	QQChannelAutoOn         bool                   `yaml:"QQChannelAutoOn"`         // QQ频道中自动开启(默认不开)
	QQChannelLogMessage     bool                   `yaml:"QQChannelLogMessage"`     // QQ频道中记录消息(默认不开)
	QQEnablePoke            bool                   `yaml:"QQEnablePoke"`            // 启用戳一戳
	TextCmdTrustOnly        bool                   `yaml:"textCmdTrustOnly"`        // 只允许信任用户或master使用text指令
	IgnoreUnaddressedBotCmd bool                   `yaml:"ignoreUnaddressedBotCmd"` // 不响应群聊裸bot指令
	UILogLimit              int64                  `yaml:"UILogLimit"`
	FriendAddComment        string                 `yaml:"friendAddComment"` // 加好友验证信息
	MasterUnlockCode        string                 `yaml:"-"`                // 解锁码,每20分钟变化一次,使用后立即变化
	MasterUnlockCodeTime    int64                  `yaml:"-"`
	CustomReplyConfigEnable bool                   `yaml:"customReplyConfigEnable"`
	CustomReplyConfig       []*ReplyConfig         `yaml:"-"`
	RefuseGroupInvite       bool                   `yaml:"refuseGroupInvite"`    // 拒绝加入新群
	UpgradeWindowID         string                 `yaml:"upgradeWindowId"`      // 执行升级指令的窗口
	UpgradeEndpointID       string                 `yaml:"upgradeEndpointId"`    // 执行升级指令的端点
	BotExtFreeSwitch        bool                   `yaml:"botExtFreeSwitch"`     // 允许任意人员开关: 否则邀请者、群主、管理员、master有权限
	TrustOnlyMode           bool                   `yaml:"trustOnlyMode"`        // 只有信任的用户/master可以拉群和使用
	AliveNoticeEnable       bool                   `yaml:"aliveNoticeEnable"`    // 定时通知
	AliveNoticeValue        string                 `yaml:"aliveNoticeValue"`     // 定时通知间隔
	ReplyDebugMode          bool                   `yaml:"replyDebugMode"`       // 回复调试
	PlayerNameWrapEnable    bool                   `yaml:"playerNameWrapEnable"` // 启用玩家名称外框

	RateLimitEnabled         bool       `yaml:"rateLimitEnabled"`      // 启用频率限制 (刷屏限制)
	PersonalReplenishRateStr string     `yaml:"personalReplenishRate"` // 个人刷屏警告速率,字符串格式
	PersonalReplenishRate    rate.Limit `yaml:"-"`                     // 个人刷屏警告速率
	GroupReplenishRateStr    string     `yaml:"groupReplenishRate"`    // 群组刷屏警告速率,字符串格式
	GroupReplenishRate       rate.Limit `yaml:"-"`                     // 群组刷屏警告速率
	PersonalBurst            int64      `yaml:"personalBurst"`         // 个人自定义上限
	GroupBurst               int64      `yaml:"groupBurst"`            // 群组自定义上限

	QuitInactiveThreshold time.Duration `yaml:"quitInactiveThreshold"` // 退出不活跃群组的时间阈值

	QuitInactiveBatchSize int64 `yaml:"quitInactiveBatchSize"` // 退出不活跃群组的批量大小
	QuitInactiveBatchWait int64 `yaml:"quitInactiveBatchWait"` // 退出不活跃群组的批量等待时间(分)

	DefaultCocRuleIndex int64 `yaml:"defaultCocRuleIndex" jsbind:"defaultCocRuleIndex"` // 默认coc index
	MaxExecuteTime      int64 `yaml:"maxExecuteTime" jsbind:"maxExecuteTime"`           // 最大骰点次数
	MaxCocCardGen       int64 `yaml:"maxCocCardGen" jsbind:"maxCocCardGen"`             // 最大coc制卡数

	ExtDefaultSettings []*ExtDefaultSettingItem `yaml:"extDefaultSettings"` // 新群扩展按此顺序加载

	BanList *BanListInfo `yaml:"banList"` //

	TextMapRaw      TextTemplateWithWeightDict `yaml:"-"`
	TextMapHelpInfo TextTemplateWithHelpDict   `yaml:"-"`
	ConfigManager   *ConfigManager             `yaml:"-"`
	Parent          *DiceManager               `yaml:"-"`

	CocExtraRules     map[int]*CocRuleInfo   `yaml:"-" json:"cocExtraRules"`
	Cron              *cron.Cron             `yaml:"-" json:"-"`
	AliveNoticeEntry  cron.EntryID           `yaml:"-" json:"-"`
	JsEnable          bool                   `yaml:"jsEnable" json:"jsEnable"`
	DisabledJsScripts map[string]bool        `yaml:"disabledJsScripts" json:"disabledJsScripts"` // 作为set
	JsPrinter         *PrinterFunc           `yaml:"-" json:"-"`
	JsRequire         *require.RequireModule `yaml:"-" json:"-"`
	JsLoop            *eventloop.EventLoop   `yaml:"-" json:"-"`
	JsScriptList      []*JsScriptInfo        `yaml:"-" json:"-"`
	// 内置脚本摘要表,用于判断内置脚本是否有更新
	JsBuiltinDigestSet map[string]bool `yaml:"-" json:"-"`
	// 当前在加载的脚本路径,用于关联 jsScriptInfo 和 ExtInfo
	JsLoadingScript *JsScriptInfo `yaml:"-" json:"-"`

	// 游戏系统规则模板
	GameSystemMap *SyncMap[string, *GameSystemTemplate] `yaml:"-" json:"-"`

	RunAfterLoaded []func() `yaml:"-" json:"-"`

	LogSizeNoticeEnable bool `yaml:"logSizeNoticeEnable"` // 开启日志数量提示
	LogSizeNoticeCount  int  `yaml:"LogSizeNoticeCount"`  // 日志数量提示阈值,默认500

	IsAlreadyLoadConfig bool `yaml:"-"` // 如果在loads前崩溃,那么不写入配置,防止覆盖为空的

	UIEndpoint *EndPointInfo `yaml:"-" json:"-"` // UI Endpoint

	MailEnable   bool   `json:"mailEnable" yaml:"mailEnable"`     // 是否启用
	MailFrom     string `json:"mailFrom" yaml:"mailFrom"`         // 邮箱来源
	MailPassword string `json:"mailPassword" yaml:"mailPassword"` // 邮箱密钥/密码
	MailSMTP     string `json:"mailSmtp" yaml:"mailSmtp"`         // 邮箱 smtp 地址

	NewsMark string `json:"newsMark" yaml:"newsMark"` // 已读新闻的md5

	EnableCensor         bool                   `json:"enableCensor" yaml:"enableCensor"` // 启用敏感词审查
	CensorManager        *CensorManager         `json:"-" yaml:"-"`
	CensorMode           CensorMode             `json:"censorMode" yaml:"censorMode"`
	CensorThresholds     map[censor.Level]int   `json:"censorThresholds" yaml:"censorThresholds"` // 敏感词阈值
	CensorHandlers       map[censor.Level]uint8 `json:"censorHandlers" yaml:"censorHandlers"`
	CensorScores         map[censor.Level]int   `json:"censorScores" yaml:"censorScores"`                 // 敏感词怒气值
	CensorCaseSensitive  bool                   `json:"censorCaseSensitive" yaml:"censorCaseSensitive"`   // 敏感词大小写敏感
	CensorMatchPinyin    bool                   `json:"censorMatchPinyin" yaml:"censorMatchPinyin"`       // 敏感词匹配拼音
	CensorFilterRegexStr string                 `json:"censorFilterRegexStr" yaml:"censorFilterRegexStr"` // 敏感词过滤字符正则

	AdvancedConfig AdvancedConfig `json:"-" yaml:"-"`

	ContainerMode bool `yaml:"-" json:"-"` // 容器模式:禁用内置适配器,不允许使用内置Lagrange和旧的内置Gocq
	// contains filtered or unexported fields
}

func (*Dice) ApplyAliveNotice

func (d *Dice) ApplyAliveNotice()

ApplyAliveNotice 存活消息(骰狗)

func (*Dice) ApplyExtDefaultSettings

func (d *Dice) ApplyExtDefaultSettings()

ApplyExtDefaultSettings 应用扩展默认配置

func (*Dice) CanSendMail

func (d *Dice) CanSendMail() bool

func (*Dice) CensorMsg

func (d *Dice) CensorMsg(mctx *MsgContext, msg *Message, checkContent string, sendContent string) (hit bool, hitWords []string, needToTerminate bool, newContent string)

func (*Dice) CocExtraRulesAdd

func (d *Dice) CocExtraRulesAdd(ruleInfo *CocRuleInfo) bool

func (*Dice) DeckCheckUpdate

func (d *Dice) DeckCheckUpdate(deckInfo *DeckInfo) (string, string, string, error)

func (*Dice) DeckUpdate

func (d *Dice) DeckUpdate(deckInfo *DeckInfo, tempFileName string) error

func (*Dice) ExprEval

func (d *Dice) ExprEval(buffer string, ctx *MsgContext) (*VMResult, string, error)

func (*Dice) ExprEvalBase

func (d *Dice) ExprEvalBase(buffer string, ctx *MsgContext, flags RollExtraFlags) (*VMResult, string, error)

func (*Dice) ExprText

func (d *Dice) ExprText(buffer string, ctx *MsgContext) (string, string, error)

func (*Dice) ExprTextBase

func (d *Dice) ExprTextBase(buffer string, ctx *MsgContext, flags RollExtraFlags) (*VMResult, string, error)

func (*Dice) ExtAliasToName

func (d *Dice) ExtAliasToName(s string) string

ExtAliasToName 将扩展别名转换成主用名, 如果没有找到则返回原值

func (*Dice) ExtFind

func (d *Dice) ExtFind(s string) *ExtInfo

ExtFind 根据名称或别名查找扩展

func (*Dice) ExtRemove

func (d *Dice) ExtRemove(ei *ExtInfo) bool

func (*Dice) GameSystemTemplateAdd

func (d *Dice) GameSystemTemplateAdd(tmpl *GameSystemTemplate) bool

GameSystemTemplateAdd 应用一个角色模板

func (*Dice) GenerateTextMap

func (d *Dice) GenerateTextMap()

func (*Dice) GetBanList

func (d *Dice) GetBanList() []*BanListInfoItem

func (*Dice) GetDiceDataPath

func (d *Dice) GetDiceDataPath(name string) string

func (*Dice) GetExtConfigFilePath

func (d *Dice) GetExtConfigFilePath(extName string, filename string) string

func (*Dice) GetExtDataDir

func (d *Dice) GetExtDataDir(extName string) string

func (*Dice) Init

func (d *Dice) Init()

func (*Dice) IsMaster

func (d *Dice) IsMaster(uid string) bool

func (*Dice) JsCheckUpdate

func (d *Dice) JsCheckUpdate(jsScriptInfo *JsScriptInfo) (string, string, string, error)

func (*Dice) JsExtSettingVacuum deprecated

func (d *Dice) JsExtSettingVacuum()

JsExtSettingVacuum 清理已被删除的脚本对应的插件配置

Deprecated: bug

func (*Dice) JsInit

func (d *Dice) JsInit()

func (*Dice) JsLoadScriptRaw

func (d *Dice) JsLoadScriptRaw(jsInfo *JsScriptInfo)

func (*Dice) JsLoadScripts

func (d *Dice) JsLoadScripts()

func (*Dice) JsParseMeta

func (d *Dice) JsParseMeta(s string, installTime time.Time, rawData []byte, builtin bool) (*JsScriptInfo, error)

func (*Dice) JsReload

func (d *Dice) JsReload()

func (*Dice) JsShutdown

func (d *Dice) JsShutdown()

func (*Dice) JsUpdate

func (d *Dice) JsUpdate(jsScriptInfo *JsScriptInfo, tempFileName string) error

func (*Dice) MarkModified

func (d *Dice) MarkModified()

func (*Dice) MasterAdd

func (d *Dice) MasterAdd(uid string)

func (*Dice) MasterCheck

func (d *Dice) MasterCheck(gid, uid string) bool

MasterCheck 检查是否有Master权限.

  • gid, uid: 群组和用户的统一ID(实际上并不区分哪个是哪个)

func (*Dice) MasterRefresh

func (d *Dice) MasterRefresh()

func (*Dice) MasterRemove

func (d *Dice) MasterRemove(uid string) bool

func (*Dice) NewCensorManager

func (d *Dice) NewCensorManager()

func (*Dice) NoticeForEveryEndpoint

func (d *Dice) NoticeForEveryEndpoint(txt string, allowCrossPlatform bool)

func (*Dice) RegisterBuiltinExt

func (d *Dice) RegisterBuiltinExt()

func (*Dice) RegisterBuiltinSystemTemplate

func (d *Dice) RegisterBuiltinSystemTemplate()

func (*Dice) RegisterExtension

func (d *Dice) RegisterExtension(extInfo *ExtInfo)

RegisterExtension 注册扩展

panic 如果扩展的Name或Aliases冲突

func (*Dice) ResetQuitInactiveCron

func (d *Dice) ResetQuitInactiveCron()

func (*Dice) Save

func (d *Dice) Save(isAuto bool)

func (*Dice) SaveText

func (d *Dice) SaveText()

func (*Dice) SendMail

func (d *Dice) SendMail(body string, m MailCode) error

func (*Dice) SendMailRow

func (d *Dice) SendMailRow(subject string, to []string, content string, attachments []string)

func (*Dice) UnlockCodeUpdate

func (d *Dice) UnlockCodeUpdate(force bool)

func (*Dice) UnlockCodeVerify

func (d *Dice) UnlockCodeVerify(code string) bool

type DiceConfig

type DiceConfig struct {
	Name       string `yaml:"name"`       // 名称,默认为default
	DataDir    string `yaml:"dataDir"`    // 数据路径,为./data/{name},例如data/default
	IsLogPrint bool   `yaml:"isLogPrint"` // 是否在控制台打印log
}

type DiceConfigs

type DiceConfigs struct {
	DiceConfigs       []DiceConfig `yaml:"diceConfigs"`
	ServeAddress      string       `yaml:"serveAddress"`
	WebUIAddress      string       `yaml:"webUIAddress"`
	HelpDocEngineType int          `yaml:"helpDocEngineType"`

	UIPasswordSalt string   `yaml:"UIPasswordFrontendSalt"`
	UIPasswordHash string   `yaml:"uiPasswordHash"`
	AccessTokens   []string `yaml:"accessTokens"`

	AutoBackupEnable    bool   `yaml:"autoBackupEnable"`
	AutoBackupTime      string `yaml:"autoBackupTime"`
	AutoBackupSelection uint64 `yaml:"autoBackupSelection"`

	BackupClean struct {
		Strategy  int    `yaml:"strategy"`
		KeepCount int    `yaml:"keepCount"`
		KeepDur   int64  `yaml:"keepDur"`
		Trigger   int    `yaml:"trigger"`
		Cron      string `yaml:"cron"`
	} `yaml:"backupClean"`

	ServiceName string `yaml:"serviceName"`

	ConfigVersion int `yaml:"configVersion"`
}

type DiceManager

type DiceManager struct {
	Dice                []*Dice
	ServeAddress        string
	Help                *HelpManager
	IsHelpReloading     bool
	UseDictForTokenizer bool
	HelpDocEngineType   int

	IsNamesReloading bool
	NamesGenerator   *NamesGenerator
	NamesInfo        map[string]map[string][]string

	UIPasswordHash string
	UIPasswordSalt string
	AccessTokens   map[string]bool
	IsReady        bool

	AutoBackupEnable    bool
	AutoBackupTime      string
	AutoBackupSelection BackupSelection

	// 备份自动清理配置
	BackupCleanStrategy  BackupCleanStrategy // 关闭 / 保留一定数量 / 保留一定时间
	BackupCleanKeepCount int                 // 保留的数量
	BackupCleanKeepDur   time.Duration       // 保留的时间
	BackupCleanTrigger   BackupCleanTrigger  // 触发方式: cron触发 / 随自动备份触发 (多种方式按位OR)
	BackupCleanCron      string              // 如果使用cron触发, 表达式

	AppBootTime      int64
	AppVersionCode   int64
	AppVersionOnline *VersionInfo

	UpdateRequestChan      chan *Dice
	UpdateDownloadedChan   chan string
	RebootRequestChan      chan int
	UpdateCheckRequestChan chan int

	GroupNameCache lockfree.HashMap // 群名缓存,全局共享, key string value *GroupNameCacheItem
	UserNameCache  lockfree.HashMap // 用户缓存,全局共享, key string value *GroupNameCacheItem
	UserIDCache    lockfree.HashMap // 用户id缓存 key username (string) value int64 目前仅Telegram adapter使用

	Cron                 *cron.Cron
	ServiceName          string
	JustForTest          bool
	JsRegistry           *require.Registry
	UpdateSealdiceByFile func(packName string, log *zap.SugaredLogger) bool // 使用指定压缩包升级海豹,如果出错返回false,如果成功进程会自动结束

	ContainerMode bool          // 容器模式:禁用内置适配器,不允许使用内置Lagrange和旧的内置Gocq
	CleanupFlag   atomic.Uint32 // 1 为正在清理,0为普通状态
	// contains filtered or unexported fields
}

func (*DiceManager) AddHelpWithDice

func (dm *DiceManager) AddHelpWithDice(dice *Dice)

func (*DiceManager) Backup

func (dm *DiceManager) Backup(sel BackupSelection, fromAuto bool) (string, error)

func (*DiceManager) BackupAuto

func (dm *DiceManager) BackupAuto() error

func (*DiceManager) BackupClean

func (dm *DiceManager) BackupClean(fromAuto bool) (err error)

func (*DiceManager) InitDice

func (dm *DiceManager) InitDice()

func (*DiceManager) InitHelp

func (dm *DiceManager) InitHelp()

func (*DiceManager) LoadDice

func (dm *DiceManager) LoadDice()

LoadDice 初始化函数

func (*DiceManager) LoadNames

func (dm *DiceManager) LoadNames()

func (*DiceManager) ResetAutoBackup

func (dm *DiceManager) ResetAutoBackup()

func (*DiceManager) ResetBackupClean

func (dm *DiceManager) ResetBackupClean()

func (*DiceManager) Save

func (dm *DiceManager) Save()

func (*DiceManager) TryCreateDefault

func (dm *DiceManager) TryCreateDefault()

func (*DiceManager) TryGetGroupName

func (dm *DiceManager) TryGetGroupName(id string) string

func (*DiceManager) TryGetUserName

func (dm *DiceManager) TryGetUserName(id string) string

type DiceRollParser

type DiceRollParser struct {
	RollExpression

	Buffer string

	Pretty bool
	// contains filtered or unexported fields
}

func (*DiceRollParser) AST

func (t *DiceRollParser) AST() *node32

func (*DiceRollParser) Add

func (t *DiceRollParser) Add(rule pegRule, begin, end, index uint32)

func (*DiceRollParser) Execute

func (p *DiceRollParser) Execute()

func (*DiceRollParser) Init

func (p *DiceRollParser) Init(options ...func(*DiceRollParser) error) error

func (*DiceRollParser) Parse

func (p *DiceRollParser) Parse(rule ...int) error

func (*DiceRollParser) PrettyPrintSyntaxTree

func (t *DiceRollParser) PrettyPrintSyntaxTree(buffer string)

func (*DiceRollParser) Print

func (t *DiceRollParser) Print()

func (*DiceRollParser) PrintSyntaxTree

func (p *DiceRollParser) PrintSyntaxTree()

func (*DiceRollParser) Reset

func (p *DiceRollParser) Reset()

func (*DiceRollParser) SprintSyntaxTree

func (p *DiceRollParser) SprintSyntaxTree() string

func (*DiceRollParser) Tokens

func (t *DiceRollParser) Tokens() []token32

func (*DiceRollParser) Trim

func (t *DiceRollParser) Trim(length uint32)

func (*DiceRollParser) WriteSyntaxTree

func (p *DiceRollParser) WriteSyntaxTree(w io.Writer)

type DoDoImageMessageComponent

type DoDoImageMessageComponent struct {
	Type     string `json:"type"` // image-group
	Elements []struct {
		Type string `json:"type"` // image
		Src  string `json:"src"`
	} `json:"elements"`
}

type DoDoTextMessageComponent

type DoDoTextMessageComponent struct {
	Type string `json:"type"` // section
	Text struct {
		Content string `json:"content"`
		Type    string `json:"type"` // plain-text
	} `json:"text"`
}

type DummyLogger

type DummyLogger struct {
	// contains filtered or unexported fields
}

func NewDummyLogger

func NewDummyLogger(logger *zap.Logger) DummyLogger

func (DummyLogger) Debug

func (d DummyLogger) Debug(v ...interface{})

func (DummyLogger) Debugf

func (d DummyLogger) Debugf(format string, v ...interface{})

func (DummyLogger) Error

func (d DummyLogger) Error(v ...interface{})

func (DummyLogger) Errorf

func (d DummyLogger) Errorf(format string, v ...interface{})

func (DummyLogger) Info

func (d DummyLogger) Info(v ...interface{})

func (DummyLogger) Infof

func (d DummyLogger) Infof(format string, v ...interface{})

func (DummyLogger) Sync

func (d DummyLogger) Sync() error

func (DummyLogger) Warn

func (d DummyLogger) Warn(v ...interface{})

func (DummyLogger) Warnf

func (d DummyLogger) Warnf(format string, v ...interface{})

type EchoWalleQ

type EchoWalleQ struct {
	Status  string `json:"status"`
	RetCode int64  `json:"retcode"`
	// 先简单处理一下
	Data    map[string]interface{} `json:"data"`
	Message string                 `json:"message"`
	Echo    string                 `json:"echo"`
}

type EndPointInfo

type EndPointInfo struct {
	EndPointInfoBase `yaml:"baseInfo" jsbind:"baseInfo"`

	Adapter PlatformAdapter `yaml:"adapter" json:"adapter"`
}

func NewDingTalkConnItem

func NewDingTalkConnItem(clientID string, token string, nickname string, robotCode string) *EndPointInfo

func NewDiscordConnItem

func NewDiscordConnItem(v AddDiscordEcho) *EndPointInfo

NewDiscordConnItem 本来没必要写这个的,但是不知道为啥依赖出问题

func NewDodoConnItem

func NewDodoConnItem(clientID string, token string) *EndPointInfo

func NewGoCqhttpConnectInfoItem

func NewGoCqhttpConnectInfoItem(account string) *EndPointInfo

func NewKookConnItem

func NewKookConnItem(token string) *EndPointInfo

func NewLagrangeConnectInfoItem

func NewLagrangeConnectInfoItem(account string) *EndPointInfo

func NewMinecraftConnItem

func NewMinecraftConnItem(url string) *EndPointInfo

func NewOfficialQQConnItem

func NewOfficialQQConnItem(appID uint64, token string, appSecret string, onlyQQGuild bool) *EndPointInfo

func NewRedConnItem

func NewRedConnItem(host string, port int, token string) *EndPointInfo

func NewSatoriConnItem

func NewSatoriConnItem(platform string, host string, port int, token string) *EndPointInfo

func NewSealChatConnItem

func NewSealChatConnItem(url string, token string) *EndPointInfo

func NewSlackConnItem

func NewSlackConnItem(at string, bt string) *EndPointInfo

func NewTelegramConnItem

func NewTelegramConnItem(token string, proxy string) *EndPointInfo

func NewWqConnectInfoItem

func NewWqConnectInfoItem(account string) *EndPointInfo

func (*EndPointInfo) AdapterSetup

func (ep *EndPointInfo) AdapterSetup()

func (*EndPointInfo) RefreshGroupNum

func (ep *EndPointInfo) RefreshGroupNum()

func (*EndPointInfo) SetEnable

func (ep *EndPointInfo) SetEnable(_ *Dice, enable bool)

SetEnable

如果已连接,将断开连接,如果开着GCQ将自动结束。如果启用的话,则反过来

func (*EndPointInfo) StatsDump

func (ep *EndPointInfo) StatsDump(d *Dice)

StatsDump EP统计数据落库

func (*EndPointInfo) StatsRestore

func (ep *EndPointInfo) StatsRestore(d *Dice)

StatsRestore 尝试从数据库中恢复EP的统计数据

func (*EndPointInfo) TriggerCommand

func (ep *EndPointInfo) TriggerCommand(mctx *MsgContext, msg *Message, cmdArgs *CmdArgs) bool

func (*EndPointInfo) UnmarshalYAML

func (ep *EndPointInfo) UnmarshalYAML(value *yaml.Node) error

type EndPointInfoBase

type EndPointInfoBase struct {
	ID                  string `yaml:"id" json:"id" jsbind:"id"` // uuid
	Nickname            string `yaml:"nickname" json:"nickname" jsbind:"nickname"`
	State               int    `yaml:"state" json:"state" jsbind:"state"` // 状态 0断开 1已连接 2连接中 3连接失败
	UserID              string `yaml:"userId" json:"userId" jsbind:"userId"`
	GroupNum            int64  `yaml:"groupNum" json:"groupNum" jsbind:"groupNum"`                                  // 拥有群数
	CmdExecutedNum      int64  `yaml:"cmdExecutedNum" json:"cmdExecutedNum" jsbind:"cmdExecutedNum"`                // 指令执行次数
	CmdExecutedLastTime int64  `yaml:"cmdExecutedLastTime" json:"cmdExecutedLastTime" jsbind:"cmdExecutedLastTime"` // 指令执行次数
	OnlineTotalTime     int64  `yaml:"onlineTotalTime" json:"onlineTotalTime" jsbind:"onlineTotalTime"`             // 在线时长

	Platform     string `yaml:"platform" json:"platform" jsbind:"platform"` // 平台,如QQ等
	RelWorkDir   string `yaml:"relWorkDir" json:"relWorkDir"`               // 工作目录
	Enable       bool   `yaml:"enable" json:"enable" jsbind:"enable"`       // 是否启用
	ProtocolType string `yaml:"protocolType" json:"protocolType"`           // 协议类型,如onebot、koishi等

	IsPublic bool       `yaml:"isPublic"`
	Session  *IMSession `yaml:"-" json:"-"`
}

type EventWalleQBase

type EventWalleQBase struct {
	ID         string  `json:"id"`          // 事件唯一标识符
	Self       Self    `json:"self"`        // 机器人自身标识
	Time       float64 `json:"time"`        // 事件发生时间(Unix 时间戳),单位:秒
	Type       string  `json:"type"`        // meta、message、notice、request 中的一个,分别表示元事件、消息事件、通知事件和请求事件
	DetailType string  `json:"detail_type"` // 详细
	SubType    string  `json:"sub_type"`    // 子类型
	// 下面这些虽然不是共有字段 但基本也算
	UserID    string `json:"user_id"`
	UserName  string `json:"user_name"`
	UserCard  string `json:"user_card"` // 群名片
	GroupID   string `json:"group_id"`
	GroupName string `json:"group_name"`
	GuildID   string `json:"guild_id"`
	ChannelID string `json:"channel_id"`
}

type EventWalleQMeta

type EventWalleQMeta struct {
	Version struct {
		Impl          string `json:"impl"`
		Version       string `json:"version"`
		OneBotVersion string `json:"onebot_version"`
	} `json:"version"`
	Status struct {
		Good bool  `json:"good"`
		Bots []Bot `json:"bots"`
	} `json:"status"`
}

EventWalleQMeta 元事件特有字段

type EventWalleQMsg

type EventWalleQMsg struct {
	MessageID  string           `json:"message_id"`  // 消息id
	Message    []MessageSegment `json:"message"`     // 消息段
	AltMessage string           `json:"alt_message"` // 文本化
}

EventWalleQMsg 消息事件特有字段

type EventWalleQNotice

type EventWalleQNotice struct {
	MessageID  string `json:"message_id"`  // 消息id
	OperatorID string `json:"operator_id"` // 操作者账号
	ReceiverID string `json:"receiver_id"` // 戳一戳的接收者
	Duration   int64  `json:"duration"`
}

EventWalleQNotice 通知事件特有字段

type EventWalleQReq

type EventWalleQReq struct {
	Message     string `json:"message"`
	RequestID   int64  `json:"request_id"` // 请求者
	Suspicious  bool   `json:"suspicious"`
	InvitorID   string `json:"invitor_id"`   // 邀请者
	InvitorName string `json:"invitor_name"` // 邀请者名
}

EventWalleQReq 请求事件特有字段

type ExtDefaultSettingItem

type ExtDefaultSettingItem struct {
	Name            string          `yaml:"name" json:"name"`
	AutoActive      bool            `yaml:"autoActive" json:"autoActive"`                // 是否自动开启
	DisabledCommand map[string]bool `yaml:"disabledCommand,flow" json:"disabledCommand"` // 实际为set
	ExtItem         *ExtInfo        `yaml:"-" json:"-"`
	Loaded          bool            `yaml:"-" json:"loaded"` // 当前插件是否正确加载. serve.yaml不保存, 前端请求时提供
}

type ExtDefaultSettingItemSlice

type ExtDefaultSettingItemSlice []*ExtDefaultSettingItem

func (ExtDefaultSettingItemSlice) Len

func (ExtDefaultSettingItemSlice) Less

func (x ExtDefaultSettingItemSlice) Less(i, _ int) bool

func (ExtDefaultSettingItemSlice) Swap

func (x ExtDefaultSettingItemSlice) Swap(i, j int)

type ExtInfo

type ExtInfo struct {
	Name    string   `yaml:"name" json:"name" jsbind:"name"`    // 名字
	Aliases []string `yaml:"-" json:"aliases" jsbind:"aliases"` // 别名
	Version string   `yaml:"-" json:"version" jsbind:"version"` // 版本
	// 作者
	// 更新时间
	AutoActive      bool      `yaml:"-" json:"-" jsbind:"autoActive"` // 是否自动开启
	CmdMap          CmdMapCls `yaml:"-" json:"-" jsbind:"cmdMap"`     // 指令集合
	Brief           string    `yaml:"-" json:"-"`
	ActiveOnPrivate bool      `yaml:"-" json:"-"`

	DefaultSetting *ExtDefaultSettingItem `yaml:"-" json:"-"` // 默认配置

	Author       string   `yaml:"-" json:"-" jsbind:"author"`
	ConflictWith []string `yaml:"-" json:"-"`
	Official     bool     `yaml:"-" json:"-"` // 官方插件

	IsJsExt bool          `json:"-"`
	Source  *JsScriptInfo `yaml:"-" json:"-"`
	Storage *buntdb.DB    `yaml:"-"  json:"-"`

	OnNotCommandReceived func(ctx *MsgContext, msg *Message)                        `yaml:"-" json:"-" jsbind:"onNotCommandReceived"` // 指令过滤后剩下的
	OnCommandOverride    func(ctx *MsgContext, msg *Message, cmdArgs *CmdArgs) bool `yaml:"-" json:"-"`                               // 覆盖指令行为

	OnCommandReceived   func(ctx *MsgContext, msg *Message, cmdArgs *CmdArgs) `yaml:"-" json:"-" jsbind:"onCommandReceived"`
	OnMessageReceived   func(ctx *MsgContext, msg *Message)                   `yaml:"-" json:"-" jsbind:"onMessageReceived"`
	OnMessageSend       func(ctx *MsgContext, msg *Message, flag string)      `yaml:"-" json:"-" jsbind:"onMessageSend"`
	OnMessageDeleted    func(ctx *MsgContext, msg *Message)                   `yaml:"-" json:"-" jsbind:"onMessageDeleted"`
	OnMessageEdit       func(ctx *MsgContext, msg *Message)                   `yaml:"-" json:"-" jsbind:"onMessageEdit"`
	OnGroupJoined       func(ctx *MsgContext, msg *Message)                   `yaml:"-" json:"-" jsbind:"onGroupJoined"`
	OnGroupMemberJoined func(ctx *MsgContext, msg *Message)                   `yaml:"-" json:"-" jsbind:"onGroupMemberJoined"`
	OnGuildJoined       func(ctx *MsgContext, msg *Message)                   `yaml:"-" json:"-" jsbind:"onGuildJoined"`
	OnBecomeFriend      func(ctx *MsgContext, msg *Message)                   `yaml:"-" json:"-" jsbind:"onBecomeFriend"`
	GetDescText         func(i *ExtInfo) string                               `yaml:"-" json:"-" jsbind:"getDescText"`
	IsLoaded            bool                                                  `yaml:"-" json:"-" jsbind:"isLoaded"`
	OnLoad              func()                                                `yaml:"-" json:"-" jsbind:"onLoad"`
	// contains filtered or unexported fields
}

func (*ExtInfo) StorageClose

func (i *ExtInfo) StorageClose() error

func (*ExtInfo) StorageGet

func (i *ExtInfo) StorageGet(k string) (string, error)

func (*ExtInfo) StorageInit

func (i *ExtInfo) StorageInit() error

func (*ExtInfo) StorageSet

func (i *ExtInfo) StorageSet(k, v string) error

type Friend

type Friend struct {
	Qid               string `json:"qid"`
	Uin               string `json:"uin"` // QQ 号
	Nick              string `json:"nick"`
	Remark            string `json:"remark"`
	LongNick          string `json:"longNick"`
	AvatarUrl         string `json:"avatarUrl"`
	Birthday_year     int    `json:"birthday_Year"`
	Birthday_month    int    `json:"birthday_Month"`
	Birthday_day      int    `json:"birthday_Day"`
	Sex               int    `json:"sex"` // 性别
	TopTime           string `json:"topTime"`
	IsBlock           bool   `json:"isBlock"` // 是否拉黑
	IsMsgDisturb      bool   `json:"isMsgDisturb"`
	IsSpecialCareOpen bool   `json:"isSpecialCareOpen"`
	IsSpecialCareZone bool   `json:"isSpecialCareZone"`
	RingId            string `json:"ringId"`
	Status            int    `json:"status"`
	ExtStatus         int    `json:"extStatus"`
	CategoryId        int    `json:"categoryId"`
	OnlyChat          bool   `json:"onlyChat"`
	QzoneNotWatch     bool   `json:"qzoneNotWatch"`
	QzoneNotWatched   bool   `json:"qzoneNotWatched"`
	VipFlag           bool   `json:"vipFlag"`
	YearVipFlag       bool   `json:"yearVipFlag"`
	SvipFlag          bool   `json:"svipFlag"`
	VipLevel          int    `json:"vipLevel"`
	Category          string `json:"category"` // 分组信息
}

type GameSystemTemplate

type GameSystemTemplate struct {
	Name         string                      `yaml:"name" json:"name"`                 // 模板名字
	FullName     string                      `yaml:"fullName" json:"fullName"`         // 全名
	Authors      []string                    `yaml:"authors" json:"authors"`           // 作者
	Version      string                      `yaml:"version" json:"version"`           // 版本
	UpdatedTime  string                      `yaml:"updatedTime" json:"updatedTime"`   // 更新日期
	TemplateVer  string                      `yaml:"templateVer" json:"templateVer"`   // 模板版本
	NameTemplate map[string]NameTemplateItem `yaml:"nameTemplate" json:"nameTemplate"` // 名片模板
	AttrConfig   AttrConfig                  `yaml:"attrConfig" json:"attrConfig"`     // 默认展示顺序
	SetConfig    SetConfig                   `yaml:"setConfig" json:"setConfig"`       // .set 命令设置

	Defaults         map[string]int64    `yaml:"defaults" json:"defaults"`                 // 默认值
	DefaultsComputed map[string]string   `yaml:"defaultsComputed" json:"defaultsComputed"` // 计算类型
	Alias            map[string][]string `yaml:"alias" json:"alias"`                       // 别名/同义词

	TextMap         *TextTemplateWithWeightDict `yaml:"textMap" json:"textMap"` // UI文本
	TextMapHelpInfo *TextTemplateWithHelpDict   `yaml:"TextMapHelpInfo" json:"textMapHelpInfo"`

	AliasMap *SyncMap[string, string] `yaml:"-" json:"-"` // 别名/同义词
}

func (*GameSystemTemplate) GetAlias

func (t *GameSystemTemplate) GetAlias(varname string) string

func (*GameSystemTemplate) GetDefaultValueEx

func (t *GameSystemTemplate) GetDefaultValueEx(ctx *MsgContext, varname string) *VMValue

func (*GameSystemTemplate) GetDefaultValueEx0

func (t *GameSystemTemplate) GetDefaultValueEx0(ctx *MsgContext, varname string) (*VMValue, string, bool, bool)

func (*GameSystemTemplate) GetRealValue

func (t *GameSystemTemplate) GetRealValue(ctx *MsgContext, k string) (*VMValue, error)

func (*GameSystemTemplate) GetShowAs

func (t *GameSystemTemplate) GetShowAs(ctx *MsgContext, k string) (*VMValue, error)

type GoCqhttpLoginInfo

type GoCqhttpLoginInfo struct {
	UIN              int64
	Password         string
	Protocol         int
	AppVersion       string
	IsAsyncRun       bool
	UseSignServer    bool
	SignServerConfig *SignServerConfig
}

type GocqAppVersion

type GocqAppVersion struct {
	ApkID           string       `json:"apk_id"`
	AppID           uint32       `json:"app_id"`
	SubAppID        uint32       `json:"sub_app_id"`
	AppKey          string       `json:"app_key"`
	SortVersionName string       `json:"sort_version_name"`
	BuildTime       uint32       `json:"build_time"`
	ApkSign         string       `json:"apk_sign"`
	SdkVersion      string       `json:"sdk_version"`
	SsoVersion      uint32       `json:"sso_version"`
	MiscBitmap      uint32       `json:"misc_bitmap"`
	MainSigMap      uint32       `json:"main_sig_map"`
	SubSigMap       uint32       `json:"sub_sig_map"`
	DumpTime        uint32       `json:"dump_time"`
	Qua             string       `json:"qua"`
	ProtocolType    ProtocolType `json:"protocol_type"`
}

type Group

type Group struct {
	GroupCode               string `json:"groupCode"`   // 群号
	MaxMember               int    `json:"maxMember"`   // 最大人数
	MemberCount             int    `json:"memberCount"` // 成员人数
	GroupName               string `json:"groupName"`   // 群名
	GroupStatus             int    `json:"groupStatus"`
	MemberRole              int    `json:"memberRole"` // 群成员角色
	IsTop                   bool   `json:"isTop"`
	ToppedTimestamp         string `json:"toppedTimestamp"`
	PrivilegeFlag           int    `json:"privilegeFlag"` // 群权限
	IsConf                  bool   `json:"isConf"`
	HasModifyConfGroupFace  bool   `json:"hasModifyConfGroupFace"`
	HasModifyConfGroupName  bool   `json:"hasModifyConfGroupName"`
	RemarkName              string `json:"remarkName"`
	HasMemo                 bool   `json:"hasMemo"`
	GroupShutupExpireTime   string `json:"groupShutupExpireTime"`
	PersonShutupExpireTime  string `json:"personShutupExpireTime"`
	DiscussToGroupUin       string `json:"discussToGroupUin"`
	DiscussToGroupMaxMsgSeq int    `json:"discussToGroupMaxMsgSeq"`
	DiscussToGroupTime      int    `json:"discussToGroupTime"`
}

type GroupInfo

type GroupInfo struct {
	Active           bool                               `json:"active" yaml:"active" jsbind:"active"`          // 是否在群内开启 - 过渡为象征意义
	ActivatedExtList []*ExtInfo                         `yaml:"activatedExtList,flow" json:"activatedExtList"` // 当前群开启的扩展列表
	Players          *SyncMap[string, *GroupPlayerInfo] `yaml:"-" json:"-"`                                    // 群员角色数据

	GroupID         string                 `yaml:"groupId" json:"groupId" jsbind:"groupId"`
	GuildID         string                 `yaml:"guildId" json:"guildId" jsbind:"guildId"`
	ChannelID       string                 `yaml:"channelId" json:"channelId" jsbind:"channelId"`
	GroupName       string                 `yaml:"groupName" json:"groupName" jsbind:"groupName"`
	DiceIDActiveMap *SyncMap[string, bool] `yaml:"diceIds,flow" json:"diceIdActiveMap"` // 对应的骰子ID(格式 平台:ID),对应单骰多号情况,例如骰A B都加了群Z,A退群不会影响B在群内服务
	DiceIDExistsMap *SyncMap[string, bool] `yaml:"-" json:"diceIdExistsMap"`            // 对应的骰子ID(格式 平台:ID)是否存在于群内
	BotList         *SyncMap[string, bool] `yaml:"botList,flow" json:"botList"`         // 其他骰子列表
	DiceSideNum     int64                  `yaml:"diceSideNum" json:"diceSideNum"`      // 以后可能会支持 1d4 这种默认面数,暂不开放给js
	System          string                 `yaml:"system" json:"system"`                // 规则系统,概念同bcdice的gamesystem,距离如dnd5e coc7

	// ValueMap     map[string]*VMValue `yaml:"-"`
	ValueMap     lockfree.HashMap `yaml:"-" json:"-"`
	HelpPackages []string         `yaml:"-" json:"helpPackages"`
	CocRuleIndex int              `yaml:"cocRuleIndex" json:"cocRuleIndex" jsbind:"cocRuleIndex"`
	LogCurName   string           `yaml:"logCurFile" json:"logCurName" jsbind:"logCurName"`
	LogOn        bool             `yaml:"logOn" json:"logOn" jsbind:"logOn"`

	QuitMarkAutoClean   bool   `yaml:"-" json:"-"` // 自动清群 - 播报,即将自动退出群组
	QuitMarkMaster      bool   `yaml:"-" json:"-"` // 骰主命令退群 - 播报,即将自动退出群组
	RecentDiceSendTime  int64  `json:"recentDiceSendTime" jsbind:"recentDiceSendTime"`
	ShowGroupWelcome    bool   `yaml:"showGroupWelcome" json:"showGroupWelcome" jsbind:"showGroupWelcome"` // 是否迎新
	GroupWelcomeMessage string `yaml:"groupWelcomeMessage" json:"groupWelcomeMessage" jsbind:"groupWelcomeMessage"`
	// FirstSpeechMade     bool   `yaml:"firstSpeechMade"` // 是否做过进群发言
	LastCustomReplyTime float64 `yaml:"-" json:"-"` // 上次自定义回复时间

	RateLimiter     *rate.Limiter `yaml:"-" json:"-"`
	RateLimitWarned bool          `yaml:"-" json:"-"`

	EnteredTime  int64  `yaml:"enteredTime" json:"enteredTime" jsbind:"enteredTime"`    // 入群时间
	InviteUserID string `yaml:"inviteUserId" json:"inviteUserId" jsbind:"inviteUserId"` // 邀请人
	// 仅用于http接口
	TmpPlayerNum int64    `yaml:"-" json:"tmpPlayerNum"`
	TmpExtList   []string `yaml:"-" json:"tmpExtList"`

	UpdatedAtTime int64 `yaml:"-" json:"-"`

	DefaultHelpGroup string `yaml:"defaultHelpGroup" json:"defaultHelpGroup"` // 当前群默认的帮助文档分组
}

func SetBotOnAtGroup

func SetBotOnAtGroup(ctx *MsgContext, groupID string) *GroupInfo

SetBotOnAtGroup 在群内开启

func (*GroupInfo) ExtActive

func (group *GroupInfo) ExtActive(ei *ExtInfo)

ExtActive 开启扩展

func (*GroupInfo) ExtClear

func (group *GroupInfo) ExtClear()

ExtClear 清除多余的扩展项

func (*GroupInfo) ExtGetActive

func (group *GroupInfo) ExtGetActive(name string) *ExtInfo

func (*GroupInfo) ExtInactive

func (group *GroupInfo) ExtInactive(ei *ExtInfo) *ExtInfo

func (*GroupInfo) ExtInactiveByName

func (group *GroupInfo) ExtInactiveByName(name string) *ExtInfo

func (*GroupInfo) GetCharTemplate

func (group *GroupInfo) GetCharTemplate(dice *Dice) *GameSystemTemplate

func (*GroupInfo) IsActive

func (group *GroupInfo) IsActive(ctx *MsgContext) bool

func (*GroupInfo) PlayerGet

func (group *GroupInfo) PlayerGet(db *sqlx.DB, id string) *GroupPlayerInfo

func (*GroupInfo) SetDefaultHelpGroup

func (group *GroupInfo) SetDefaultHelpGroup(target string)

SetDefaultHelpGroup 设置群默认搜索分组

type GroupMember

type GroupMember struct {
	Uid        string `json:"uid"`
	Qid        string `json:"qid"`
	Uin        string `json:"uin"`
	Nick       string `json:"nick"`
	Remark     string `json:"remark"`
	CardType   int    `json:"cardType"`
	CardName   string `json:"cardName"`
	Role       int    `json:"role"` // 2-普通成员 3-管理 4-群主
	AvatarPath string `json:"avatarPath"`
	ShutUpTime int64  `json:"shutUpTime"`
	IsDelete   bool   `json:"isDelete"`
}

type GroupNameCacheItem

type GroupNameCacheItem struct {
	Name string
	// contains filtered or unexported fields
}

type GroupPlayerInfo

type GroupPlayerInfo model.GroupPlayerInfoBase

func (*GroupPlayerInfo) GetValueNameByAlias

func (i *GroupPlayerInfo) GetValueNameByAlias(s string, alias map[string][]string) string

type GroupPlayerInfoBase

type GroupPlayerInfoBase struct {
	Name                string `yaml:"name" jsbind:"name"` // 玩家昵称
	UserID              string `yaml:"userId" jsbind:"userId"`
	InGroup             bool   `yaml:"inGroup"`                                          // 是否在群内,有时一个人走了,信息还暂时残留
	LastCommandTime     int64  `yaml:"lastCommandTime" jsbind:"lastCommandTime"`         // 上次发送指令时间
	AutoSetNameTemplate string `yaml:"autoSetNameTemplate" jsbind:"autoSetNameTemplate"` // 名片模板

	DiceSideNum  int                  `yaml:"diceSideNum"` // 面数,为0时等同于d100
	Vars         *PlayerVariablesItem `yaml:"-"`           // 玩家的群内变量
	ValueMapTemp lockfree.HashMap     `yaml:"-"`           // 玩家的群内临时变量

	TempValueAlias *map[string][]string `yaml:"-"` // 群内临时变量别名 - 其实这个有点怪的,为什么在这里?

	UpdatedAtTime int64 `yaml:"-" json:"-"`
}

GroupPlayerInfoBase 群内玩家信息

type GuildPermCacheItem

type GuildPermCacheItem struct {
	Perm int64
	// contains filtered or unexported fields
}

type HTTPSimpleMessage

type HTTPSimpleMessage struct {
	UID         string `json:"uid"`
	Message     string `json:"message"`
	MessageType string `json:"messageType"`
}

type HelpConfig

type HelpConfig struct {
	Aliases map[string][]string `yaml:"aliases" json:"aliases"`
}

type HelpDoc

type HelpDoc struct {
	Key        string `json:"key"`
	Name       string `json:"name"`
	Path       string `json:"path"`
	Group      string `json:"group"`
	Type       string `json:"type"`
	IsDir      bool   `json:"isDir"`
	LoadStatus int    `json:"loadStatus"`
	Deleted    bool   `json:"deleted"`

	Children []*HelpDoc `json:"children"`
}

type HelpDocFormat

type HelpDocFormat struct {
	Mod     string            `json:"mod"`
	Author  string            `json:"author"`
	Brief   string            `json:"brief"`
	Comment string            `json:"comment"`
	Helpdoc map[string]string `json:"helpdoc"`
}

type HelpManager

type HelpManager struct {
	CurID      uint64
	Index      bleve.Index
	TextMap    map[string]*HelpTextItem
	Parent     *DiceManager
	EngineType int

	LoadingFn    string
	HelpDocTree  []*HelpDoc
	GroupAliases map[string]string

	Config *HelpConfig
	// contains filtered or unexported fields
}

func (*HelpManager) AddItem

func (m *HelpManager) AddItem(item HelpTextItem) error

func (*HelpManager) AddItemApply

func (m *HelpManager) AddItemApply() error

func (*HelpManager) Close

func (m *HelpManager) Close()

func (*HelpManager) DeleteHelpDoc

func (m *HelpManager) DeleteHelpDoc(keys []string) error

func (*HelpManager) GetContent

func (m *HelpManager) GetContent(item *HelpTextItem, depth int) string

func (*HelpManager) GetHelpItemPage

func (m *HelpManager) GetHelpItemPage(pageNum, pageSize int, id, group, from, title string) (int, HelpTextVos)

func (*HelpManager) GetNextID

func (m *HelpManager) GetNextID() string

func (*HelpManager) GetPrefixText

func (m *HelpManager) GetPrefixText() string

func (*HelpManager) GetShowBestOffset

func (m *HelpManager) GetShowBestOffset() int

func (*HelpManager) GetSuffixText

func (m *HelpManager) GetSuffixText() string

func (*HelpManager) Load

func (m *HelpManager) Load()

func (*HelpManager) SaveHelpConfig

func (m *HelpManager) SaveHelpConfig(config *HelpConfig) error

func (*HelpManager) Search

func (m *HelpManager) Search(ctx *MsgContext, text string, titleOnly bool, pageSize, pageNum int, group string) (res *bleve.SearchResult, total, pageStart, pageEnd int, err error)

func (*HelpManager) UploadHelpDoc

func (m *HelpManager) UploadHelpDoc(src io.Reader, group string, name string) error

type HelpTextItem

type HelpTextItem struct {
	Group       string
	From        string
	Title       string
	Content     string
	PackageName string
	KeyWords    string
	RelatedExt  []string
}

type HelpTextItems

type HelpTextItems []*HelpTextItem

func (HelpTextItems) Len

func (e HelpTextItems) Len() int

func (HelpTextItems) String

func (e HelpTextItems) String(i int) string

type HelpTextVo

type HelpTextVo struct {
	ID          int    `json:"id"`
	Group       string `json:"group"`
	From        string `json:"from"`
	Title       string `json:"title"`
	Content     string `json:"content"`
	PackageName string `json:"packageName"`
	KeyWords    string `json:"keyWords"`
}

type HelpTextVos

type HelpTextVos []HelpTextVo

func (HelpTextVos) Len

func (h HelpTextVos) Len() int

func (HelpTextVos) Less

func (h HelpTextVos) Less(i, j int) bool

func (HelpTextVos) Swap

func (h HelpTextVos) Swap(i, j int)

type IMSession

type IMSession struct {
	Parent    *Dice           `yaml:"-"`
	EndPoints []*EndPointInfo `yaml:"endPoints"`

	ServiceAtNew   map[string]*GroupInfo                 `json:"servicesAt" yaml:"-"`
	PlayerVarsData SyncMap[string, *PlayerVariablesItem] `yaml:"-"` // 感觉似乎没有什么存本地的必要
}

func (*IMSession) Execute

func (s *IMSession) Execute(ep *EndPointInfo, msg *Message, runInSync bool)

func (*IMSession) ExecuteNew

func (s *IMSession) ExecuteNew(ep *EndPointInfo, msg *Message)

ExecuteNew Note(Szzrain): 既不破坏兼容性还要支持新 feature 我真是草了,这里是 copy paste 的代码稍微改了一下,我知道这是在屎山上建房子,但是没办法 只有在 Adapter 内部实现了新的消息段解析才能使用这个方法,即 Message.Segment 有值 为了避免破坏兼容性,Message.Message 中的内容不会被解析但仍然会赋值 这个 ExcuteNew 方法优化了对消息段的解析,其他平台应当尽快实现消息段解析并使用这个方法

func (*IMSession) GetEpByPlatform

func (s *IMSession) GetEpByPlatform(p string) *EndPointInfo

GetEpByPlatform 在 EndPoints 中找到第一个符合平台 p 且启用的

func (*IMSession) LongTimeQuitInactiveGroup

func (s *IMSession) LongTimeQuitInactiveGroup(threshold, hint time.Time, roundIntervalMinute int, groupsPerRound int)

LongTimeQuitInactiveGroup 另一种退群方案,其中minute代表间隔多久执行一次,num代表一次退几个群(每次退群之间有10秒的等待时间)

func (*IMSession) OnGroupJoined

func (s *IMSession) OnGroupJoined(ctx *MsgContext, msg *Message)

OnGroupJoined 群组进群事件处理,其他 Adapter 应当尽快迁移至此方法实现

func (*IMSession) OnGroupMemberJoined

func (s *IMSession) OnGroupMemberJoined(ctx *MsgContext, msg *Message)

OnGroupMemberJoined 群成员进群事件处理,除了 bot 自己以外的群成员入群时调用。其他 Adapter 应当尽快迁移至此方法实现

func (*IMSession) OnMessageDeleted

func (s *IMSession) OnMessageDeleted(mctx *MsgContext, msg *Message)

func (*IMSession) OnMessageEdit

func (s *IMSession) OnMessageEdit(ctx *MsgContext, msg *Message)

OnMessageEdit 消息编辑事件

msg.Message 应为更新后的消息, msg.Time 应为更新时间而非发送时间,同时 msg.RawID 应确保为原消息的 ID (一些 API 同时会有系统事件 ID,勿混淆)

依据 API,Sender 不一定存在,ctx 信息亦不一定有效

func (*IMSession) OnMessageSend

func (s *IMSession) OnMessageSend(ctx *MsgContext, msg *Message, flag string)

func (*IMSession) PreTriggerCommand

func (s *IMSession) PreTriggerCommand(mctx *MsgContext, msg *Message, cmdArgs *CmdArgs)

type Int64SliceDesc

type Int64SliceDesc []int64

func (Int64SliceDesc) Len

func (x Int64SliceDesc) Len() int

func (Int64SliceDesc) Less

func (x Int64SliceDesc) Less(i, j int) bool

func (Int64SliceDesc) Swap

func (x Int64SliceDesc) Swap(i, j int)

type JsScriptDepends

type JsScriptDepends struct {
	/** 作者 */
	Author string `json:"author"`
	/** 名称 */
	Name string `json:"name"`
	/** 版本限制 */
	Constraint *semver.Constraints `json:"constraint"`
	/** 原始依赖Key */
	RawKey string `json:"rawKey"`
}

type JsScriptInfo

type JsScriptInfo struct {
	/** 名称 */
	Name string `json:"name"`
	/** 是否启用 */
	Enable bool `json:"enable"`
	/** 版本 */
	Version string `json:"version"`
	/** 作者 */
	Author string `json:"author"`
	/** 许可协议 */
	License string `json:"license"`
	/** 网址 */
	HomePage string `json:"homepage"`
	/** 详细描述 */
	Desc string `json:"desc"`
	/** 所需权限 */
	Grant []string `json:"grant"`
	/** 更新时间 */
	UpdateTime int64 `json:"updateTime"`
	/** 安装时间 - 文件创建时间 */
	InstallTime int64 `json:"installTime"`
	/** 最近一条错误文本 */
	ErrText string `json:"errText"`
	/** 实际文件名 */
	Filename string `json:"filename"`
	/** 更新链接 */
	UpdateUrls []string `json:"updateUrls"`
	/** etag */
	Etag string `json:"etag"`
	/** 是否官方插件 */
	Official bool `json:"official"`

	/** 是否内置插件 */
	Builtin bool `json:"builtin"`
	/** 内容摘要 */
	Digest string `json:"-"`
	/** 依赖项 */
	Depends []JsScriptDepends `json:"depends"`
	// contains filtered or unexported fields
}

type Kwarg

type Kwarg struct {
	Name        string `json:"name" jsbind:"name"`
	ValueExists bool   `json:"valueExists" jsbind:"valueExists"`
	Value       string `json:"value" jsbind:"value"`
	AsBool      bool   `json:"asBool" jsbind:"asBool"`
}

func (*Kwarg) String

func (kwa *Kwarg) String() string

type LastWelcomeInfo

type LastWelcomeInfo struct {
	UserID  string
	GroupID string
	Time    int64
}

type LastWelcomeInfoWQ

type LastWelcomeInfoWQ struct {
	UserID  string
	GroupID string
	Time    float64
}

type MSData

type MSData struct {
	ID        int64   `json:"id,omitempty"`
	Text      string  `json:"text,omitempty"`
	UserID    string  `json:"user_id,omitempty"`
	UserName  string  `json:"user_name,omitempty"`
	Face      string  `json:"face,omitempty"`
	MessageID string  `json:"message_id,omitempty"`
	FileID    string  `json:"fileId,omitempty"`
	Time      float64 `json:"time,omitempty"`
	URL       string  `json:"url,omitempty"`
}

type MailCode

type MailCode int
const (
	// MailTypeConnectClose 掉线
	MailTypeConnectClose MailCode = iota
	// MailTypeCIAMLock 风控 // tx 云把 Customer Identity Access Management 叫做 账号风控平台……
	MailTypeCIAMLock
	// MailTypeNotice 通知
	MailTypeNotice
	// MailTypeSendNote send 指令
	MailTypeSendNote
	// MailTest 测试邮件
	MailTest
)

type Message

type Message struct {
	Time        int64       `json:"time" jsbind:"time"`               // 发送时间
	MessageType string      `json:"messageType" jsbind:"messageType"` // group private
	GroupID     string      `json:"groupId" jsbind:"groupId"`         // 群号,如果是群聊消息
	GuildID     string      `json:"guildId" jsbind:"guildId"`         // 服务器群组号,会在discord,kook,dodo等平台见到
	ChannelID   string      `json:"channelId" jsbind:"channelId"`
	Sender      SenderBase  `json:"sender" jsbind:"sender"`     // 发送者
	Message     string      `json:"message" jsbind:"message"`   // 消息内容
	RawID       interface{} `json:"rawId" jsbind:"rawId"`       // 原始信息ID,用于处理撤回等
	Platform    string      `json:"platform" jsbind:"platform"` // 当前平台
	GroupName   string      `json:"groupName"`
	TmpUID      string      `json:"-" yaml:"-"`
	// Note(Szzrain): 这里是消息段,为了支持多种消息类型,目前只有 LagrangeGo 支持,其他平台也应该尽快迁移支持,并使用 Session.ExecuteNew 方法
	Segment []message.IMessageElement `json:"-" yaml:"-" jsbind:"segment"`
}

Message 消息的重要信息 时间 发送地点(群聊/私聊) 人物(是谁发的) 内容

type MessageEvent

type MessageEvent struct {
	Content     string `json:"content"`
	IsAdmin     bool   `json:"isAdmin"`
	Name        string `json:"name"`
	UUID        string `json:"uuid"`
	MessageType string `json:"messageType"`
}

type MessageMinecraft

type MessageMinecraft struct {
	Event *MessageEvent `json:"event"`
	Type  string        `json:"type"`
}

type MessageQQ

type MessageQQ struct {
	MessageQQBase
	Message string `json:"message"` // 消息内容
}

type MessageQQArray

type MessageQQArray struct {
	MessageQQBase
	Message []*OneBotV11MsgItem `json:"message"` // 消息内容
}

type MessageQQBase

type MessageQQBase struct {
	MessageID     int64           `json:"message_id"`   // QQ信息此类型为int64,频道中为string
	MessageType   string          `json:"message_type"` // Group
	Sender        *Sender         `json:"sender"`       // 发送者
	RawMessage    string          `json:"raw_message"`
	Time          int64           `json:"time"` // 发送时间
	MetaEventType string          `json:"meta_event_type"`
	OperatorID    json.RawMessage `json:"operator_id"`  // 操作者帐号
	GroupID       json.RawMessage `json:"group_id"`     // 群号
	PostType      string          `json:"post_type"`    // 上报类型,如group、notice
	RequestType   string          `json:"request_type"` // 请求类型,如group
	SubType       string          `json:"sub_type"`     // 子类型,如add invite
	Flag          string          `json:"flag"`         // 请求 flag, 在调用处理请求的 API 时需要传入
	NoticeType    string          `json:"notice_type"`
	UserID        json.RawMessage `json:"user_id"`
	SelfID        json.RawMessage `json:"self_id"`
	Duration      int64           `json:"duration"`
	Comment       string          `json:"comment"`
	TargetID      json.RawMessage `json:"target_id"`

	Data *struct {
		// 个人信息
		Nickname string          `json:"nickname"`
		UserID   json.RawMessage `json:"user_id"`

		// 群信息
		GroupID         json.RawMessage `json:"group_id"`          // 群号
		GroupCreateTime uint32          `json:"group_create_time"` // 群号
		MemberCount     int64           `json:"member_count"`
		GroupName       string          `json:"group_name"`
		MaxMemberCount  int32           `json:"max_member_count"`

		// 群成员信息
		Card string `json:"card"`
	} `json:"data"`
	Retcode int64 `json:"retcode"`
	// Status string `json:"status"`
	Echo json.RawMessage `json:"echo"` // 声明类型而不是interface的原因是interface下数字不能正确转换

	Msg string `json:"msg"`
	// Status  interface{} `json:"status"`
	Wording string `json:"wording"`
}

type MessageQQChannel

type MessageQQChannel struct {
	MessageType string `json:"message_type"` // guild
	SubType     string `json:"sub_type"`     // 子类型,channel
	GuildID     string `json:"guild_id"`     // 频道ID
	ChannelID   string `json:"channel_id"`   // 子频道ID
	// UserId      int    `json:"user_id"` // 这个不稳定 有时候是int64
	MessageID string `json:"message_id"` // QQ信息此类型为int64,频道中为string
	Message   string `json:"message"`    // 消息内容
	Time      int64  `json:"time"`       // 发送时间 文档上没有实际有
	PostType  string `json:"post_type"`  // 目前只见到message
	// self_id 2589922907 QQ号
	// self_tiny_id 个人频道ID
	SelfTinyID string `json:"self_tiny_id"` // 文档上没有,个人频道ID
	NoticeType string `json:"notice_type"`  // 文档上没有,但实际有。撤回有信息

	Sender *SenderChannel `json:"sender"` // 发送者
	Echo   int            `json:"echo"`
}

type MessageSegment

type MessageSegment struct {
	Type string `json:"type"`
	Data MSData `json:"data"`
}

type MsgCheckResult

type MsgCheckResult struct {
	UserID            string
	Level             censor.Level
	HitCounts         map[censor.Level]int
	CurSensitiveWords []string
}

type MsgContext

type MsgContext struct {
	MessageType string
	Group       *GroupInfo       `jsbind:"group"`  // 当前群信息
	Player      *GroupPlayerInfo `jsbind:"player"` // 当前群的玩家数据

	EndPoint        *EndPointInfo `jsbind:"endPoint"` // 对应的Endpoint
	Session         *IMSession    // 对应的IMSession
	Dice            *Dice         // 对应的 Dice
	IsCurGroupBotOn bool          `jsbind:"isCurGroupBotOn"` // 在群内是否bot on

	IsPrivate       bool        `jsbind:"isPrivate"` // 是否私聊
	CommandID       int64       // 指令ID
	CommandHideFlag string      // 暗骰标记
	CommandInfo     interface{} // 命令信息
	PrivilegeLevel  int         `jsbind:"privilegeLevel"` // 权限等级 -30ban 40邀请者 50管理 60群主 70信任 100master
	GroupRoleLevel  int         // 群内权限 40邀请者 50管理 60群主 70信任 100master,相当于不考虑ban的权限等级
	DelegateText    string      `jsbind:"delegateText"`  // 代骰附加文本
	AliasPrefixText string      `json:"aliasPrefixText"` // 快捷指令回复前缀文本

	DeckPools map[*DeckInfo]map[string]*ShuffleRandomPool // 不放回抽取的缓存

	SystemTemplate    *GameSystemTemplate
	Censored          bool // 已检查过敏感词
	SpamCheckedGroup  bool
	SpamCheckedPerson bool
	// contains filtered or unexported fields
}

func CreateTempCtx

func CreateTempCtx(ep *EndPointInfo, msg *Message) *MsgContext

CreateTempCtx 制作ctx,需要msg.MessageType和msg.Sender.UserId,以及ep.Session

func GetCtxProxyAtPos

func GetCtxProxyAtPos(ctx *MsgContext, cmdArgs *CmdArgs, pos int) *MsgContext

GetCtxProxyAtPos

func GetCtxProxyAtPosRaw

func GetCtxProxyAtPosRaw(ctx *MsgContext, cmdArgs *CmdArgs, pos int, setTempVar bool) *MsgContext

GetCtxProxyAtPosRaw 等着后续再加 @名字 版本,以及 @team 版本

func GetCtxProxyFirst

func GetCtxProxyFirst(ctx *MsgContext, cmdArgs *CmdArgs) *MsgContext

GetCtxProxyFirst 第三个参数是否取消再观察一下

func (*MsgContext) ChBindCur

func (ctx *MsgContext) ChBindCur(name string) bool

func (*MsgContext) ChBindCurGet

func (ctx *MsgContext) ChBindCurGet() string

ChBindCurGet 获取当前群绑定角色

func (*MsgContext) ChBindGet

func (ctx *MsgContext) ChBindGet(name string) lockfree.HashMap

ChBindGet 获取一个正在绑定状态的卡,可用于该卡片是否绑卡检测

func (*MsgContext) ChBindGetList

func (ctx *MsgContext) ChBindGetList(name string) []string

func (*MsgContext) ChExists

func (ctx *MsgContext) ChExists(name string) bool

func (*MsgContext) ChGet

func (ctx *MsgContext) ChGet(name string) lockfree.HashMap

func (*MsgContext) ChLoad

func (ctx *MsgContext) ChLoad(name string) lockfree.HashMap

ChLoad 加载角色,成功返回角色表,失败返回nil

func (*MsgContext) ChNew

func (ctx *MsgContext) ChNew(name string) bool

ChNew 新建角色

func (*MsgContext) ChUnbind

func (ctx *MsgContext) ChUnbind(name string) []string

ChUnbind 解除某个角色的绑定

func (*MsgContext) ChUnbindCur

func (ctx *MsgContext) ChUnbindCur() (string, bool)

func (*MsgContext) ChVarsClear

func (ctx *MsgContext) ChVarsClear() int

func (*MsgContext) ChVarsGet

func (ctx *MsgContext) ChVarsGet() (lockfree.HashMap, bool)

ChVarsGet 获取当前的角色变量

func (*MsgContext) ChVarsNumGet

func (ctx *MsgContext) ChVarsNumGet() int

func (*MsgContext) ChVarsUpdateTime

func (ctx *MsgContext) ChVarsUpdateTime()

func (*MsgContext) InitSplitKey

func (ctx *MsgContext) InitSplitKey()

func (*MsgContext) LoadGroupVars

func (ctx *MsgContext) LoadGroupVars()

func (*MsgContext) LoadPlayerGlobalVars

func (ctx *MsgContext) LoadPlayerGlobalVars() *PlayerVariablesItem

LoadPlayerGlobalVars 加载个人全局数据

func (*MsgContext) LoadPlayerGroupVars

func (ctx *MsgContext) LoadPlayerGroupVars(group *GroupInfo, player *GroupPlayerInfo) *PlayerVariablesItem

LoadPlayerGroupVars 加载个人群内数据

func (*MsgContext) Notice

func (ctx *MsgContext) Notice(txt string)

func (*MsgContext) NoticeCrossPlatform

func (ctx *MsgContext) NoticeCrossPlatform(txt string)

func (*MsgContext) SplitText

func (ctx *MsgContext) SplitText(text string) []string

func (*MsgContext) TranslateSplit

func (ctx *MsgContext) TranslateSplit(s string) string

type NameTemplateItem

type NameTemplateItem struct {
	Template string `yaml:"template" json:"template"`
	HelpText string `yaml:"helpText" json:"helpText"`
}

type NamesGenerator

type NamesGenerator struct {
	NamesInfo map[string]map[string][]string
}

func (*NamesGenerator) Load

func (ng *NamesGenerator) Load()

func (*NamesGenerator) NameGenerate

func (ng *NamesGenerator) NameGenerate(rule string) string

type OneBotV11ArrMsgItem

type OneBotV11ArrMsgItem[T any] struct {
	Type string `json:"type"`
	Data T      `json:"data"`
}

type OneBotV11MsgItem

type OneBotV11MsgItem struct {
	Type string                 `json:"type"`
	Data map[string]interface{} `json:"data"`
}

type OneBotV11MsgItemAtType

type OneBotV11MsgItemAtType struct {
	QQ string `json:"qq"`
}

type OneBotV11MsgItemFaceType

type OneBotV11MsgItemFaceType struct {
	Id string `json:"id"`
}

type OneBotV11MsgItemImageType

type OneBotV11MsgItemImageType struct {
	File string `json:"file"`
}

type OneBotV11MsgItemPokeType

type OneBotV11MsgItemPokeType struct {
	Type string `json:"type"`
	Id   string `json:"id"`
}

type OneBotV11MsgItemRecordType

type OneBotV11MsgItemRecordType struct {
	File string `json:"file"`
}

type OneBotV11MsgItemReplyType

type OneBotV11MsgItemReplyType struct {
	Id string `json:"id"`
}

type OneBotV11MsgItemTextType

type OneBotV11MsgItemTextType struct {
	Text string `json:"text"`
}

type OneBotV12Command

type OneBotV12Command struct {
	Action string      `json:"action"`
	Params interface{} `json:"params"`
	Echo   string      `json:"echo"`
}

type OnebotGroupInfo

type OnebotGroupInfo struct {
	GroupID         int64  `json:"group_id"`          // 群号
	GroupName       string `json:"group_name"`        // 群名称
	GroupMemo       string `json:"group_memo"`        // 群备注
	GroupCreateTime uint32 `json:"group_create_time"` // 群创建时间
	GroupLevel      uint32 `json:"group_level"`       // 群等级
	MemberCount     int32  `json:"member_count"`      // 成员数
	MaxMemberCount  int32  `json:"max_member_count"`  // 最大成员数(群容量)
}

type OnebotUserInfo

type OnebotUserInfo struct {
	// 个人信息
	Nickname string `json:"nickname"`
	UserID   string `json:"user_id"`

	// 群信息
	GroupID         string `json:"group_id"`          // 群号
	GroupCreateTime uint32 `json:"group_create_time"` // 群号
	MemberCount     int64  `json:"member_count"`
	GroupName       string `json:"group_name"`
	MaxMemberCount  int32  `json:"max_member_count"`
	Card            string `json:"card"`
}

type OnebotV12UserInfo

type OnebotV12UserInfo struct {
	// 个人信息
	Nickname string `json:"nickname"`
	UserID   string `json:"user_id"`

	// 群信息
	GroupID         string `json:"group_id"`          // 群号
	GroupCreateTime uint32 `json:"group_create_time"` // 群号
	MemberCount     int64  `json:"member_count"`
	GroupName       string `json:"group_name"`
	MaxMemberCount  int32  `json:"max_member_count"`
	Card            string `json:"card"`
}

type OpenQQIDType

type OpenQQIDType = int
const (
	OpenQQUnknown OpenQQIDType = iota

	OpenQQUser
	OpenQQGroupOpenid
	OpenQQGroupMemberOpenid

	OpenQQCHUser
	OpenQQCHGuild
	OpenQQCHChannel
)

type PlatformAdapter

type PlatformAdapter interface {
	Serve() int
	DoRelogin() bool
	SetEnable(enable bool)
	QuitGroup(ctx *MsgContext, ID string)

	SendToPerson(ctx *MsgContext, userID string, text string, flag string)
	SendToGroup(ctx *MsgContext, groupID string, text string, flag string)
	SetGroupCardName(ctx *MsgContext, name string)

	SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)
	SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

	SendFileToPerson(ctx *MsgContext, userID string, path string, flag string)
	SendFileToGroup(ctx *MsgContext, groupID string, path string, flag string)

	MemberBan(groupID string, userID string, duration int64)
	MemberKick(groupID string, userID string)

	GetGroupInfoAsync(groupID string)

	// EditMessage replace the content of the message with msgID with message.
	// Context is retrieved from ctx.
	EditMessage(ctx *MsgContext, msgID, message string)
	// RecallMessage recalls the message with msgID. Context is retrieved from ctx.
	RecallMessage(ctx *MsgContext, msgID string)
}

type PlatformAdapterDingTalk

type PlatformAdapterDingTalk struct {
	Session       *IMSession        `yaml:"-" json:"-"`
	ClientID      string            `yaml:"clientID" json:"clientID"`
	Token         string            `yaml:"token" json:"token"`
	RobotCode     string            `yaml:"robotCode" json:"robotCode"`
	CoolAppCode   string            `yaml:"coolAppCode" json:"coolAppCode"`
	EndPoint      *EndPointInfo     `yaml:"-" json:"-"`
	IntentSession *dingtalk.Session `yaml:"-" json:"-"`
}

func (*PlatformAdapterDingTalk) DoRelogin

func (pa *PlatformAdapterDingTalk) DoRelogin() bool

func (*PlatformAdapterDingTalk) EditMessage

func (pa *PlatformAdapterDingTalk) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterDingTalk) GetGroupInfoAsync

func (pa *PlatformAdapterDingTalk) GetGroupInfoAsync(groupID string)

func (*PlatformAdapterDingTalk) MemberBan

func (pa *PlatformAdapterDingTalk) MemberBan(groupID string, userID string, duration int64)

func (*PlatformAdapterDingTalk) MemberKick

func (pa *PlatformAdapterDingTalk) MemberKick(groupID string, userID string)

func (*PlatformAdapterDingTalk) OnChatReceive

func (*PlatformAdapterDingTalk) OnGroupJoined

func (pa *PlatformAdapterDingTalk) OnGroupJoined(_ *dingtalk.Session, data *dingtalk.GroupJoinedEvent)

func (*PlatformAdapterDingTalk) QuitGroup

func (pa *PlatformAdapterDingTalk) QuitGroup(ctx *MsgContext, id string)

func (*PlatformAdapterDingTalk) RecallMessage

func (pa *PlatformAdapterDingTalk) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterDingTalk) SendFileToGroup

func (pa *PlatformAdapterDingTalk) SendFileToGroup(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterDingTalk) SendFileToPerson

func (pa *PlatformAdapterDingTalk) SendFileToPerson(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterDingTalk) SendSegmentToGroup

func (pa *PlatformAdapterDingTalk) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterDingTalk) SendSegmentToPerson

func (pa *PlatformAdapterDingTalk) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterDingTalk) SendToGroup

func (pa *PlatformAdapterDingTalk) SendToGroup(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterDingTalk) SendToPerson

func (pa *PlatformAdapterDingTalk) SendToPerson(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterDingTalk) Serve

func (pa *PlatformAdapterDingTalk) Serve() int

func (*PlatformAdapterDingTalk) SetEnable

func (pa *PlatformAdapterDingTalk) SetEnable(enable bool)

func (*PlatformAdapterDingTalk) SetGroupCardName

func (pa *PlatformAdapterDingTalk) SetGroupCardName(ctx *MsgContext, name string)

type PlatformAdapterDiscord

type PlatformAdapterDiscord struct {
	Session            *IMSession         `yaml:"-" json:"-"`
	Token              string             `yaml:"token" json:"token"`
	ProxyURL           string             `yaml:"proxyURL" json:"proxyURL"`
	ReverseProxyUrl    string             `yaml:"reverseProxyUrl" json:"reverseProxyUrl"`
	ReverseProxyCDNUrl string             `yaml:"reverseProxyCDNUrl" json:"reverseProxyCDNUrl"`
	EndPoint           *EndPointInfo      `yaml:"-" json:"-"`
	IntentSession      *discordgo.Session `yaml:"-" json:"-"`
}

PlatformAdapterDiscord 只有token需要记录,别的是生成的

func (*PlatformAdapterDiscord) DoRelogin

func (pa *PlatformAdapterDiscord) DoRelogin() bool

DoRelogin 重新登录,虽然似乎没什么实现的必要,但还是写一下

func (*PlatformAdapterDiscord) EditMessage

func (pa *PlatformAdapterDiscord) EditMessage(ctx *MsgContext, msgID, message string)

func (*PlatformAdapterDiscord) GetGroupInfoAsync

func (pa *PlatformAdapterDiscord) GetGroupInfoAsync(groupID string)

GetGroupInfoAsync 同步一下群组信息

func (*PlatformAdapterDiscord) MemberBan

func (pa *PlatformAdapterDiscord) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterDiscord) MemberKick

func (pa *PlatformAdapterDiscord) MemberKick(_ string, _ string)

func (*PlatformAdapterDiscord) QuitGroup

func (pa *PlatformAdapterDiscord) QuitGroup(_ *MsgContext, id string)

QuitGroup 退出服务器

func (*PlatformAdapterDiscord) RecallMessage

func (pa *PlatformAdapterDiscord) RecallMessage(ctx *MsgContext, msgID string)

func (*PlatformAdapterDiscord) SendFileToGroup

func (pa *PlatformAdapterDiscord) SendFileToGroup(_ *MsgContext, groupID string, path string, _ string)

func (*PlatformAdapterDiscord) SendFileToPerson

func (pa *PlatformAdapterDiscord) SendFileToPerson(_ *MsgContext, userID string, path string, _ string)

func (*PlatformAdapterDiscord) SendSegmentToGroup

func (pa *PlatformAdapterDiscord) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterDiscord) SendSegmentToPerson

func (pa *PlatformAdapterDiscord) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterDiscord) SendToGroup

func (pa *PlatformAdapterDiscord) SendToGroup(ctx *MsgContext, groupID string, text string, flag string)

SendToGroup 发送群聊(实际上是频道)消息

func (*PlatformAdapterDiscord) SendToPerson

func (pa *PlatformAdapterDiscord) SendToPerson(ctx *MsgContext, userID string, text string, flag string)

SendToPerson 这里发送的是私聊(dm)消息,私信对于discord来说也被视为一个频道

func (*PlatformAdapterDiscord) Serve

func (pa *PlatformAdapterDiscord) Serve() int

Serve 启动服务,返回0就是成功,1就是失败

func (*PlatformAdapterDiscord) SetEnable

func (pa *PlatformAdapterDiscord) SetEnable(enable bool)

SetEnable 禁用之后骰子仍然有可能显示在线一段时间,可能是因为没有挥手机制,不过已经不会接收到事件了

func (*PlatformAdapterDiscord) SetGroupCardName

func (pa *PlatformAdapterDiscord) SetGroupCardName(ctx *MsgContext, name string)

SetGroupCardName 没有改变用户在某个频道中昵称的功能,一旦更改就是整个服务器范围内都改

type PlatformAdapterDodo

type PlatformAdapterDodo struct {
	Session           *IMSession                                             `yaml:"-" json:"-"`
	ClientID          string                                                 `yaml:"clientID" json:"clientID"`
	Token             string                                                 `yaml:"token" json:"token"`
	EndPoint          *EndPointInfo                                          `yaml:"-" json:"-"`
	Client            client.Client                                          `yaml:"-" json:"-"`
	WebSocket         websocket.Client                                       `yaml:"-" json:"-"`
	UserPermCache     SyncMap[string, *SyncMap[string, *GuildPermCacheItem]] `yaml:"-" json:"-"`
	RetryConnectTimes int                                                    `yaml:"-" json:"-"` // 重连次数
}

func (*PlatformAdapterDodo) DoRelogin

func (pa *PlatformAdapterDodo) DoRelogin() bool

func (*PlatformAdapterDodo) EditMessage

func (pa *PlatformAdapterDodo) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterDodo) GetGroupInfoAsync

func (pa *PlatformAdapterDodo) GetGroupInfoAsync(groupID string)

func (*PlatformAdapterDodo) MemberBan

func (pa *PlatformAdapterDodo) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterDodo) MemberKick

func (pa *PlatformAdapterDodo) MemberKick(_ string, _ string)

func (*PlatformAdapterDodo) QuitGroup

func (pa *PlatformAdapterDodo) QuitGroup(ctx *MsgContext, groupId string)

func (*PlatformAdapterDodo) RecallMessage

func (pa *PlatformAdapterDodo) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterDodo) SendFileToGroup

func (pa *PlatformAdapterDodo) SendFileToGroup(ctx *MsgContext, groupID string, path string, flag string)

func (*PlatformAdapterDodo) SendFileToPerson

func (pa *PlatformAdapterDodo) SendFileToPerson(ctx *MsgContext, userID string, path string, flag string)

func (*PlatformAdapterDodo) SendMessageRaw

func (pa *PlatformAdapterDodo) SendMessageRaw(ctx *MsgContext, msgBody model.IMessageBody, uid string, isPrivate bool, referenceMessageId string) error

func (*PlatformAdapterDodo) SendSegmentToGroup

func (pa *PlatformAdapterDodo) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterDodo) SendSegmentToPerson

func (pa *PlatformAdapterDodo) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterDodo) SendToChatRaw

func (pa *PlatformAdapterDodo) SendToChatRaw(ctx *MsgContext, uid string, text string, isPrivate bool) error

func (*PlatformAdapterDodo) SendToGroup

func (pa *PlatformAdapterDodo) SendToGroup(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterDodo) SendToPerson

func (pa *PlatformAdapterDodo) SendToPerson(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterDodo) SendToPersonRaw

func (pa *PlatformAdapterDodo) SendToPersonRaw(ctx *MsgContext, uid string, text string, isPrivate bool) error

func (*PlatformAdapterDodo) Serve

func (pa *PlatformAdapterDodo) Serve() int

func (*PlatformAdapterDodo) SetEnable

func (pa *PlatformAdapterDodo) SetEnable(enable bool)

func (*PlatformAdapterDodo) SetGroupCardName

func (pa *PlatformAdapterDodo) SetGroupCardName(ctx *MsgContext, name string)

type PlatformAdapterGocq

type PlatformAdapterGocq struct {
	EndPoint *EndPointInfo `yaml:"-" json:"-"`
	Session  *IMSession    `yaml:"-" json:"-"`

	IsReverse   bool   `yaml:"isReverse" json:"isReverse" `
	ReverseAddr string `yaml:"reverseAddr" json:"reverseAddr"`

	Socket      *gowebsocket.Socket `yaml:"-" json:"-"`
	ConnectURL  string              `yaml:"connectUrl" json:"connectUrl"`   // 连接地址
	AccessToken string              `yaml:"accessToken" json:"accessToken"` // 访问令牌

	UseInPackClient bool   `yaml:"useInPackGoCqhttp" json:"useInPackGoCqhttp"` // 是否使用内置的gocqhttp
	BuiltinMode     string `yaml:"builtinMode" json:"builtinMode"`             // 分为 lagrange 和 gocq
	GoCqhttpState   int    `yaml:"-" json:"loginState"`                        // 当前状态
	CurLoginIndex   int    `yaml:"-" json:"curLoginIndex"`                     // 当前登录序号,如果正在进行的登录不是该Index,证明过时

	GoCqhttpProcess           *procs.Process `yaml:"-" json:"-"`
	GocqhttpLoginFailedReason string         `yaml:"-" json:"curLoginFailedReason"` // 当前登录失败原因

	GoCqhttpLoginCaptcha       string `yaml:"-" json:"goCqHttpLoginCaptcha"`
	GoCqhttpLoginVerifyCode    string `yaml:"-" json:"goCqHttpLoginVerifyCode"`
	GoCqhttpLoginDeviceLockURL string `yaml:"-" json:"goCqHttpLoginDeviceLockUrl"`
	GoCqhttpQrcodeData         []byte `yaml:"-" json:"-"` // 二维码数据
	GoCqhttpSmsNumberTip       string `yaml:"-" json:"goCqHttpSmsNumberTip"`

	GoCqLastAutoLoginTime      int64 `yaml:"inPackGoCqLastAutoLoginTime" json:"-"`                             // 上次自动重新登录的时间
	GoCqhttpLoginSucceeded     bool  `yaml:"inPackGoCqHttpLoginSucceeded" json:"-"`                            // 是否登录成功过
	GoCqhttpLastRestrictedTime int64 `yaml:"inPackGoCqHttpLastRestricted" json:"inPackGoCqHttpLastRestricted"` // 上次风控时间
	ForcePrintLog              bool  `yaml:"forcePrintLog" json:"forcePrintLog"`                               // 是否一定输出日志,隐藏配置项

	InPackGoCqhttpProtocol   int    `yaml:"inPackGoCqHttpProtocol" json:"inPackGoCqHttpProtocol"`
	InPackGoCqhttpAppVersion string `yaml:"inPackGoCqHttpAppVersion" json:"inPackGoCqHttpAppVersion"`
	InPackGoCqhttpPassword   string `yaml:"inPackGoCqHttpPassword" json:"-"`

	InPackGoCqhttpDisconnectedCH chan int `yaml:"-" json:"-"`                                     // 信号量,用于关闭连接
	IgnoreFriendRequest          bool     `yaml:"ignoreFriendRequest" json:"ignoreFriendRequest"` // 忽略好友请求处理开关

	Implementation string `yaml:"implementation" json:"implementation"`

	UseSignServer    bool              `yaml:"useSignServer" json:"useSignServer"`
	SignServerConfig *SignServerConfig `yaml:"signServerConfig" json:"signServerConfig"`
	ExtraArgs        string            `yaml:"extraArgs" json:"extraArgs"`
	// contains filtered or unexported fields
}

func (*PlatformAdapterGocq) DeleteFriend

func (pa *PlatformAdapterGocq) DeleteFriend(_ *MsgContext, id string)

func (*PlatformAdapterGocq) DoRelogin

func (pa *PlatformAdapterGocq) DoRelogin() bool

func (*PlatformAdapterGocq) EditMessage

func (pa *PlatformAdapterGocq) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterGocq) GetGroupInfo

func (pa *PlatformAdapterGocq) GetGroupInfo(groupID string, noCache bool) *OnebotGroupInfo

GetGroupInfo 获取群聊信息

func (*PlatformAdapterGocq) GetGroupInfoAsync

func (pa *PlatformAdapterGocq) GetGroupInfoAsync(groupID string)

GetGroupInfoAsync 异步获取群聊信息

func (*PlatformAdapterGocq) GetGroupMemberInfo

func (pa *PlatformAdapterGocq) GetGroupMemberInfo(groupID string, userID string) *OnebotUserInfo

GetGroupMemberInfo 获取群成员信息

func (*PlatformAdapterGocq) GetLoginInfo

func (pa *PlatformAdapterGocq) GetLoginInfo()

func (*PlatformAdapterGocq) GetStrangerInfo

func (pa *PlatformAdapterGocq) GetStrangerInfo(userID string) *OnebotUserInfo

GetStrangerInfo 获取陌生人信息

func (*PlatformAdapterGocq) IsInLogin

func (pa *PlatformAdapterGocq) IsInLogin() bool

func (*PlatformAdapterGocq) IsLoginSuccessed

func (pa *PlatformAdapterGocq) IsLoginSuccessed() bool

func (*PlatformAdapterGocq) MemberBan

func (pa *PlatformAdapterGocq) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterGocq) MemberKick

func (pa *PlatformAdapterGocq) MemberKick(_ string, _ string)

func (*PlatformAdapterGocq) QQChannelTrySolve

func (pa *PlatformAdapterGocq) QQChannelTrySolve(message string)

func (*PlatformAdapterGocq) QuitGroup

func (pa *PlatformAdapterGocq) QuitGroup(_ *MsgContext, id string)

func (*PlatformAdapterGocq) RecallMessage

func (pa *PlatformAdapterGocq) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterGocq) SendFileToGroup

func (pa *PlatformAdapterGocq) SendFileToGroup(ctx *MsgContext, groupID string, path string, flag string)

func (*PlatformAdapterGocq) SendFileToPerson

func (pa *PlatformAdapterGocq) SendFileToPerson(ctx *MsgContext, userID string, path string, _ string)

func (*PlatformAdapterGocq) SendSegmentToGroup

func (pa *PlatformAdapterGocq) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterGocq) SendSegmentToPerson

func (pa *PlatformAdapterGocq) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterGocq) SendToChannelGroup

func (pa *PlatformAdapterGocq) SendToChannelGroup(ctx *MsgContext, userID string, text string, flag string)

func (*PlatformAdapterGocq) SendToGroup

func (pa *PlatformAdapterGocq) SendToGroup(ctx *MsgContext, groupID string, text string, flag string)

func (*PlatformAdapterGocq) SendToPerson

func (pa *PlatformAdapterGocq) SendToPerson(ctx *MsgContext, userID string, text string, flag string)

func (*PlatformAdapterGocq) Serve

func (pa *PlatformAdapterGocq) Serve() int

func (*PlatformAdapterGocq) SetEnable

func (pa *PlatformAdapterGocq) SetEnable(enable bool)

func (*PlatformAdapterGocq) SetFriendAddRequest

func (pa *PlatformAdapterGocq) SetFriendAddRequest(flag string, approve bool, remark string, reaseon string)

func (*PlatformAdapterGocq) SetGroupAddRequest

func (pa *PlatformAdapterGocq) SetGroupAddRequest(flag string, subType string, approve bool, reason string)

SetGroupAddRequest 同意加群

func (*PlatformAdapterGocq) SetGroupCardName

func (pa *PlatformAdapterGocq) SetGroupCardName(ctx *MsgContext, name string)

func (*PlatformAdapterGocq) SetGroupCardNameBase

func (pa *PlatformAdapterGocq) SetGroupCardNameBase(groupID int64, userID int64, card string)

SetGroupCardNameBase 设置群名片

func (*PlatformAdapterGocq) SetQQProtocol

func (pa *PlatformAdapterGocq) SetQQProtocol(protocol int) bool

func (*PlatformAdapterGocq) SetSignServer

func (pa *PlatformAdapterGocq) SetSignServer(signServerConfig *SignServerConfig) bool

type PlatformAdapterHTTP

type PlatformAdapterHTTP struct {
	Session       *IMSession
	EndPoint      *EndPointInfo
	RecentMessage []HTTPSimpleMessage
}

func (*PlatformAdapterHTTP) DoRelogin

func (pa *PlatformAdapterHTTP) DoRelogin() bool

func (*PlatformAdapterHTTP) EditMessage

func (pa *PlatformAdapterHTTP) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterHTTP) GetGroupInfoAsync

func (pa *PlatformAdapterHTTP) GetGroupInfoAsync(_ string)

func (*PlatformAdapterHTTP) MemberBan

func (pa *PlatformAdapterHTTP) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterHTTP) MemberKick

func (pa *PlatformAdapterHTTP) MemberKick(_ string, _ string)

func (*PlatformAdapterHTTP) QuitGroup

func (pa *PlatformAdapterHTTP) QuitGroup(_ *MsgContext, _ string)

func (*PlatformAdapterHTTP) RecallMessage

func (pa *PlatformAdapterHTTP) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterHTTP) SendFileToGroup

func (pa *PlatformAdapterHTTP) SendFileToGroup(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterHTTP) SendFileToPerson

func (pa *PlatformAdapterHTTP) SendFileToPerson(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterHTTP) SendSegmentToGroup

func (pa *PlatformAdapterHTTP) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterHTTP) SendSegmentToPerson

func (pa *PlatformAdapterHTTP) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterHTTP) SendToGroup

func (pa *PlatformAdapterHTTP) SendToGroup(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterHTTP) SendToPerson

func (pa *PlatformAdapterHTTP) SendToPerson(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterHTTP) Serve

func (pa *PlatformAdapterHTTP) Serve() int

func (*PlatformAdapterHTTP) SetEnable

func (pa *PlatformAdapterHTTP) SetEnable(_ bool)

func (*PlatformAdapterHTTP) SetGroupCardName

func (pa *PlatformAdapterHTTP) SetGroupCardName(_ *MsgContext, _ string)

type PlatformAdapterKook

type PlatformAdapterKook struct {
	Session       *IMSession    `yaml:"-" json:"-"`
	Token         string        `yaml:"token" json:"token"`
	EndPoint      *EndPointInfo `yaml:"-" json:"-"`
	IntentSession *kook.Session `yaml:"-" json:"-"`
}

PlatformAdapterKook 与 PlatformAdapterDiscord 基本相同的实现,因此不详细写注释了,可以去参考隔壁的实现

func (*PlatformAdapterKook) DoRelogin

func (pa *PlatformAdapterKook) DoRelogin() bool

func (*PlatformAdapterKook) EditMessage

func (pa *PlatformAdapterKook) EditMessage(ctx *MsgContext, msgID, message string)

func (*PlatformAdapterKook) GetGroupInfoAsync

func (pa *PlatformAdapterKook) GetGroupInfoAsync(groupID string)

func (*PlatformAdapterKook) MemberBan

func (pa *PlatformAdapterKook) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterKook) MemberKick

func (pa *PlatformAdapterKook) MemberKick(_ string, _ string)

func (*PlatformAdapterKook) MessageCreateRaw

func (pa *PlatformAdapterKook) MessageCreateRaw(base kook.MessageCreateBase, id string, isPrivate bool) error

func (*PlatformAdapterKook) QuitGroup

func (pa *PlatformAdapterKook) QuitGroup(_ *MsgContext, groupID string)

func (*PlatformAdapterKook) RecallMessage

func (pa *PlatformAdapterKook) RecallMessage(ctx *MsgContext, msgID string)

func (*PlatformAdapterKook) SendFileToChannelRaw

func (pa *PlatformAdapterKook) SendFileToChannelRaw(id string, path string, private bool)

func (*PlatformAdapterKook) SendFileToGroup

func (pa *PlatformAdapterKook) SendFileToGroup(_ *MsgContext, groupID string, path string, _ string)

func (*PlatformAdapterKook) SendFileToPerson

func (pa *PlatformAdapterKook) SendFileToPerson(_ *MsgContext, userID string, path string, _ string)

func (*PlatformAdapterKook) SendSegmentToGroup

func (pa *PlatformAdapterKook) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterKook) SendSegmentToPerson

func (pa *PlatformAdapterKook) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterKook) SendToChannelRaw

func (pa *PlatformAdapterKook) SendToChannelRaw(id string, text string, private bool)

func (*PlatformAdapterKook) SendToGroup

func (pa *PlatformAdapterKook) SendToGroup(ctx *MsgContext, groupID string, text string, flag string)

func (*PlatformAdapterKook) SendToPerson

func (pa *PlatformAdapterKook) SendToPerson(ctx *MsgContext, userID string, text string, flag string)

func (*PlatformAdapterKook) Serve

func (pa *PlatformAdapterKook) Serve() int

func (*PlatformAdapterKook) SetEnable

func (pa *PlatformAdapterKook) SetEnable(enable bool)

func (*PlatformAdapterKook) SetGroupCardName

func (pa *PlatformAdapterKook) SetGroupCardName(ctx *MsgContext, name string)

type PlatformAdapterMinecraft

type PlatformAdapterMinecraft struct {
	Session      *IMSession          `yaml:"-" json:"-"`
	EndPoint     *EndPointInfo       `yaml:"-" json:"-"`
	Socket       *gowebsocket.Socket `yaml:"-" json:"-"`
	RetryTimes   int                 `yaml:"-" json:"-"`
	Reconnecting bool                `yaml:"-" json:"-"`
	ConnectURL   string              `yaml:"connectUrl" json:"connectUrl"` // 连接地址
}

func (*PlatformAdapterMinecraft) DoRelogin

func (pa *PlatformAdapterMinecraft) DoRelogin() bool

func (*PlatformAdapterMinecraft) EditMessage

func (pa *PlatformAdapterMinecraft) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterMinecraft) GetGroupInfoAsync

func (pa *PlatformAdapterMinecraft) GetGroupInfoAsync(_ string)

func (*PlatformAdapterMinecraft) MemberBan

func (pa *PlatformAdapterMinecraft) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterMinecraft) MemberKick

func (pa *PlatformAdapterMinecraft) MemberKick(_ string, _ string)

func (*PlatformAdapterMinecraft) QuitGroup

func (pa *PlatformAdapterMinecraft) QuitGroup(_ *MsgContext, _ string)

func (*PlatformAdapterMinecraft) RecallMessage

func (pa *PlatformAdapterMinecraft) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterMinecraft) SendFileToGroup

func (pa *PlatformAdapterMinecraft) SendFileToGroup(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterMinecraft) SendFileToPerson

func (pa *PlatformAdapterMinecraft) SendFileToPerson(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterMinecraft) SendSegmentToGroup

func (pa *PlatformAdapterMinecraft) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterMinecraft) SendSegmentToPerson

func (pa *PlatformAdapterMinecraft) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterMinecraft) SendToGroup

func (pa *PlatformAdapterMinecraft) SendToGroup(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterMinecraft) SendToPerson

func (pa *PlatformAdapterMinecraft) SendToPerson(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterMinecraft) Serve

func (pa *PlatformAdapterMinecraft) Serve() int

func (*PlatformAdapterMinecraft) SetEnable

func (pa *PlatformAdapterMinecraft) SetEnable(enable bool)

func (*PlatformAdapterMinecraft) SetGroupCardName

func (pa *PlatformAdapterMinecraft) SetGroupCardName(_ *MsgContext, _ string)

type PlatformAdapterOfficialQQ

type PlatformAdapterOfficialQQ struct {
	Session  *IMSession    `yaml:"-" json:"-"`
	EndPoint *EndPointInfo `yaml:"-" json:"-"`

	AppID       uint64 `yaml:"appID" json:"appID"`
	AppSecret   string `yaml:"appSecret" json:"appSecret"`
	Token       string `yaml:"token" json:"token"`
	OnlyQQGuild bool   `yaml:"onlyQQGuild" json:"onlyQQGuild"`

	Api            qqapi.OpenAPI        `yaml:"-" json:"-"`
	SessionManager qqbot.SessionManager `yaml:"-" json:"-"`
	Ctx            context.Context      `yaml:"-" json:"-"`
	CancelFunc     context.CancelFunc   `yaml:"-" json:"-"`
}

func (*PlatformAdapterOfficialQQ) ChannelAtMessageReceive

func (pa *PlatformAdapterOfficialQQ) ChannelAtMessageReceive(event *dto.WSPayload, data *dto.WSATMessageData) error

func (*PlatformAdapterOfficialQQ) DoRelogin

func (pa *PlatformAdapterOfficialQQ) DoRelogin() bool

func (*PlatformAdapterOfficialQQ) EditMessage

func (pa *PlatformAdapterOfficialQQ) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterOfficialQQ) GetGroupInfoAsync

func (pa *PlatformAdapterOfficialQQ) GetGroupInfoAsync(groupID string)

func (*PlatformAdapterOfficialQQ) GroupAtMessageReceive

func (pa *PlatformAdapterOfficialQQ) GroupAtMessageReceive(event *dto.WSPayload, data *dto.WSGroupATMessageData) error

func (*PlatformAdapterOfficialQQ) GuildDirectMessageReceive

func (pa *PlatformAdapterOfficialQQ) GuildDirectMessageReceive(event *dto.WSPayload, data *dto.WSDirectMessageData) error

func (*PlatformAdapterOfficialQQ) MemberBan

func (pa *PlatformAdapterOfficialQQ) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterOfficialQQ) MemberKick

func (pa *PlatformAdapterOfficialQQ) MemberKick(_ string, _ string)

func (*PlatformAdapterOfficialQQ) QuitGroup

func (pa *PlatformAdapterOfficialQQ) QuitGroup(_ *MsgContext, _ string)

func (*PlatformAdapterOfficialQQ) RecallMessage

func (pa *PlatformAdapterOfficialQQ) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterOfficialQQ) SendFileToGroup

func (pa *PlatformAdapterOfficialQQ) SendFileToGroup(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterOfficialQQ) SendFileToPerson

func (pa *PlatformAdapterOfficialQQ) SendFileToPerson(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterOfficialQQ) SendSegmentToGroup

func (pa *PlatformAdapterOfficialQQ) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterOfficialQQ) SendSegmentToPerson

func (pa *PlatformAdapterOfficialQQ) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterOfficialQQ) SendToGroup

func (pa *PlatformAdapterOfficialQQ) SendToGroup(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterOfficialQQ) SendToPerson

func (pa *PlatformAdapterOfficialQQ) SendToPerson(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterOfficialQQ) Serve

func (pa *PlatformAdapterOfficialQQ) Serve() int

func (*PlatformAdapterOfficialQQ) SetEnable

func (pa *PlatformAdapterOfficialQQ) SetEnable(enable bool)

func (*PlatformAdapterOfficialQQ) SetGroupCardName

func (pa *PlatformAdapterOfficialQQ) SetGroupCardName(_ *MsgContext, _ string)

type PlatformAdapterRed

type PlatformAdapterRed struct {
	Session     *IMSession    `yaml:"-" json:"-"`
	EndPoint    *EndPointInfo `yaml:"-" json:"-"`
	DiceServing bool          `yaml:"-"` // 是否正在连接中

	Host       string `yaml:"host" json:"host"`
	Port       int    `yaml:"port" json:"port"`
	Token      string `yaml:"token" json:"token"`
	RedVersion string `yaml:"-" json:"redVersion"`
	// contains filtered or unexported fields
}

func (*PlatformAdapterRed) DoRelogin

func (pa *PlatformAdapterRed) DoRelogin() bool

func (*PlatformAdapterRed) EditMessage

func (pa *PlatformAdapterRed) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterRed) GetGroupInfoAsync

func (pa *PlatformAdapterRed) GetGroupInfoAsync(_ string)

func (*PlatformAdapterRed) MemberBan

func (pa *PlatformAdapterRed) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterRed) MemberKick

func (pa *PlatformAdapterRed) MemberKick(_ string, _ string)

func (*PlatformAdapterRed) QuitGroup

func (pa *PlatformAdapterRed) QuitGroup(_ *MsgContext, id string)

func (*PlatformAdapterRed) RecallMessage

func (pa *PlatformAdapterRed) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterRed) SendFileToGroup

func (pa *PlatformAdapterRed) SendFileToGroup(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterRed) SendFileToPerson

func (pa *PlatformAdapterRed) SendFileToPerson(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterRed) SendSegmentToGroup

func (pa *PlatformAdapterRed) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterRed) SendSegmentToPerson

func (pa *PlatformAdapterRed) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterRed) SendToGroup

func (pa *PlatformAdapterRed) SendToGroup(ctx *MsgContext, groupId string, text string, flag string)

func (*PlatformAdapterRed) SendToPerson

func (pa *PlatformAdapterRed) SendToPerson(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterRed) Serve

func (pa *PlatformAdapterRed) Serve() int

func (*PlatformAdapterRed) SetEnable

func (pa *PlatformAdapterRed) SetEnable(enable bool)

func (*PlatformAdapterRed) SetGroupCardName

func (pa *PlatformAdapterRed) SetGroupCardName(ctx *MsgContext, name string)

type PlatformAdapterSatori

type PlatformAdapterSatori struct {
	Session     *IMSession    `yaml:"-" json:"-"`
	EndPoint    *EndPointInfo `yaml:"-" json:"-"`
	DiceServing bool          `yaml:"-"`

	Version  string `yaml:"version" json:"version"`
	Platform string `yaml:"platform" json:"platform"`
	Host     string `yaml:"host" json:"host"`
	Port     int    `yaml:"port" json:"port"`
	Token    string `yaml:"token" json:"token"`

	Ctx        context.Context    `yaml:"-" json:"-"`
	CancelFunc context.CancelFunc `yaml:"-" json:"-"`
	// contains filtered or unexported fields
}

func (*PlatformAdapterSatori) DoRelogin

func (pa *PlatformAdapterSatori) DoRelogin() bool

func (*PlatformAdapterSatori) EditMessage

func (pa *PlatformAdapterSatori) EditMessage(ctx *MsgContext, msgID, message string)

func (*PlatformAdapterSatori) GetGroupInfoAsync

func (pa *PlatformAdapterSatori) GetGroupInfoAsync(groupID string)

func (*PlatformAdapterSatori) MemberBan

func (pa *PlatformAdapterSatori) MemberBan(groupID string, userID string, duration int64)

func (*PlatformAdapterSatori) MemberKick

func (pa *PlatformAdapterSatori) MemberKick(groupID string, userID string)

func (*PlatformAdapterSatori) QuitGroup

func (pa *PlatformAdapterSatori) QuitGroup(ctx *MsgContext, _ string)

func (*PlatformAdapterSatori) RecallMessage

func (pa *PlatformAdapterSatori) RecallMessage(ctx *MsgContext, msgID string)

func (*PlatformAdapterSatori) SendFileToGroup

func (pa *PlatformAdapterSatori) SendFileToGroup(ctx *MsgContext, groupID string, path string, flag string)

func (*PlatformAdapterSatori) SendFileToPerson

func (pa *PlatformAdapterSatori) SendFileToPerson(ctx *MsgContext, userID string, path string, flag string)

func (*PlatformAdapterSatori) SendSegmentToGroup

func (pa *PlatformAdapterSatori) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterSatori) SendSegmentToPerson

func (pa *PlatformAdapterSatori) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterSatori) SendToGroup

func (pa *PlatformAdapterSatori) SendToGroup(ctx *MsgContext, groupID string, text string, flag string)

func (*PlatformAdapterSatori) SendToPerson

func (pa *PlatformAdapterSatori) SendToPerson(ctx *MsgContext, userID string, text string, flag string)

func (*PlatformAdapterSatori) Serve

func (pa *PlatformAdapterSatori) Serve() int

func (*PlatformAdapterSatori) SetEnable

func (pa *PlatformAdapterSatori) SetEnable(enable bool)

func (*PlatformAdapterSatori) SetGroupCardName

func (pa *PlatformAdapterSatori) SetGroupCardName(ctx *MsgContext, name string)

type PlatformAdapterSealChat

type PlatformAdapterSealChat struct {
	Session  *IMSession    `yaml:"-" json:"-"`
	EndPoint *EndPointInfo `yaml:"-" json:"-"`

	ConnectURL string                    `yaml:"connectUrl" json:"connectUrl"` // 连接地址
	Token      string                    `yaml:"token" json:"token"`
	Socket     *gowebsocket.Socket       `yaml:"-" json:"-"`
	EchoMap    SyncMap[string, chan any] `yaml:"-" json:"-"`
	UserID     string                    `yaml:"-" json:"-"`

	Reconnecting bool `yaml:"-" json:"-"`
	RetryTimes   int  `yaml:"-" json:"-"`
}

func (*PlatformAdapterSealChat) DoRelogin

func (pa *PlatformAdapterSealChat) DoRelogin() bool

func (*PlatformAdapterSealChat) EditMessage

func (pa *PlatformAdapterSealChat) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterSealChat) GetGroupInfoAsync

func (pa *PlatformAdapterSealChat) GetGroupInfoAsync(_ string)

func (*PlatformAdapterSealChat) MemberBan

func (pa *PlatformAdapterSealChat) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterSealChat) MemberKick

func (pa *PlatformAdapterSealChat) MemberKick(_ string, _ string)

func (*PlatformAdapterSealChat) QuitGroup

func (pa *PlatformAdapterSealChat) QuitGroup(_ *MsgContext, _ string)

func (*PlatformAdapterSealChat) RecallMessage

func (pa *PlatformAdapterSealChat) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterSealChat) SendFileToGroup

func (pa *PlatformAdapterSealChat) SendFileToGroup(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterSealChat) SendFileToPerson

func (pa *PlatformAdapterSealChat) SendFileToPerson(ctx *MsgContext, uid string, path string, flag string)

func (*PlatformAdapterSealChat) SendSegmentToGroup

func (pa *PlatformAdapterSealChat) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterSealChat) SendSegmentToPerson

func (pa *PlatformAdapterSealChat) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterSealChat) SendToGroup

func (pa *PlatformAdapterSealChat) SendToGroup(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterSealChat) SendToPerson

func (pa *PlatformAdapterSealChat) SendToPerson(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterSealChat) Serve

func (pa *PlatformAdapterSealChat) Serve() int

func (*PlatformAdapterSealChat) SetEnable

func (pa *PlatformAdapterSealChat) SetEnable(enable bool)

func (*PlatformAdapterSealChat) SetGroupCardName

func (pa *PlatformAdapterSealChat) SetGroupCardName(mctx *MsgContext, text string)

type PlatformAdapterSlack

type PlatformAdapterSlack struct {
	Session  *IMSession    `yaml:"-" json:"-"`
	EndPoint *EndPointInfo `yaml:"-" json:"-"`
	Client   *sm.Client    `yaml:"-" json:"-"`
	BotToken string        `yaml:"botToken" json:"botToken"`
	AppToken string        `yaml:"appToken" json:"appToken"`
	// contains filtered or unexported fields
}

func (*PlatformAdapterSlack) DoRelogin

func (pa *PlatformAdapterSlack) DoRelogin() bool

func (*PlatformAdapterSlack) EditMessage

func (pa *PlatformAdapterSlack) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterSlack) GetGroupInfoAsync

func (pa *PlatformAdapterSlack) GetGroupInfoAsync(groupId string)

func (*PlatformAdapterSlack) MemberBan

func (pa *PlatformAdapterSlack) MemberBan(groupId string, userId string, duration int64)

func (*PlatformAdapterSlack) MemberKick

func (pa *PlatformAdapterSlack) MemberKick(groupId string, userId string)

func (*PlatformAdapterSlack) QuitGroup

func (pa *PlatformAdapterSlack) QuitGroup(ctx *MsgContext, id string)

func (*PlatformAdapterSlack) RecallMessage

func (pa *PlatformAdapterSlack) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterSlack) SendFileToGroup

func (pa *PlatformAdapterSlack) SendFileToGroup(ctx *MsgContext, groupID string, path string, flag string)

func (*PlatformAdapterSlack) SendFileToPerson

func (pa *PlatformAdapterSlack) SendFileToPerson(ctx *MsgContext, userID string, path string, flag string)

func (*PlatformAdapterSlack) SendSegmentToGroup

func (pa *PlatformAdapterSlack) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterSlack) SendSegmentToPerson

func (pa *PlatformAdapterSlack) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterSlack) SendToGroup

func (pa *PlatformAdapterSlack) SendToGroup(ctx *MsgContext, groupID string, text string, flag string)

func (*PlatformAdapterSlack) SendToPerson

func (pa *PlatformAdapterSlack) SendToPerson(ctx *MsgContext, userID string, text string, flag string)

func (*PlatformAdapterSlack) Serve

func (pa *PlatformAdapterSlack) Serve() int

func (*PlatformAdapterSlack) SetEnable

func (pa *PlatformAdapterSlack) SetEnable(enable bool)

func (*PlatformAdapterSlack) SetGroupCardName

func (pa *PlatformAdapterSlack) SetGroupCardName(ctx *MsgContext, name string)

type PlatformAdapterTelegram

type PlatformAdapterTelegram struct {
	Session       *IMSession       `yaml:"-" json:"-"`
	Token         string           `yaml:"token" json:"token"`
	ProxyURL      string           `yaml:"proxyURL" json:"proxyURL"`
	EndPoint      *EndPointInfo    `yaml:"-" json:"-"`
	IntentSession *tgbotapi.BotAPI `yaml:"-" json:"-"`
	ActiveTime    time.Time        `yaml:"-" json:"-"` // 用于区分adapter关闭时堆积的消息,不进入配置文件
}

func (*PlatformAdapterTelegram) DoRelogin

func (pa *PlatformAdapterTelegram) DoRelogin() bool

func (*PlatformAdapterTelegram) EditMessage

func (pa *PlatformAdapterTelegram) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterTelegram) GetGroupInfoAsync

func (pa *PlatformAdapterTelegram) GetGroupInfoAsync(groupID string)

func (*PlatformAdapterTelegram) MemberBan

func (pa *PlatformAdapterTelegram) MemberBan(_ string, _ string, _ int64)

func (*PlatformAdapterTelegram) MemberKick

func (pa *PlatformAdapterTelegram) MemberKick(_ string, _ string)

func (*PlatformAdapterTelegram) QuitGroup

func (pa *PlatformAdapterTelegram) QuitGroup(_ *MsgContext, id string)

func (*PlatformAdapterTelegram) RecallMessage

func (pa *PlatformAdapterTelegram) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterTelegram) SendFileToGroup

func (pa *PlatformAdapterTelegram) SendFileToGroup(_ *MsgContext, uid string, path string, _ string)

func (*PlatformAdapterTelegram) SendFileToPerson

func (pa *PlatformAdapterTelegram) SendFileToPerson(_ *MsgContext, uid string, path string, _ string)

func (*PlatformAdapterTelegram) SendSegmentToGroup

func (pa *PlatformAdapterTelegram) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterTelegram) SendSegmentToPerson

func (pa *PlatformAdapterTelegram) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterTelegram) SendToChatRaw

func (pa *PlatformAdapterTelegram) SendToChatRaw(uid string, text string)

func (*PlatformAdapterTelegram) SendToGroup

func (pa *PlatformAdapterTelegram) SendToGroup(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterTelegram) SendToPerson

func (pa *PlatformAdapterTelegram) SendToPerson(ctx *MsgContext, uid string, text string, flag string)

func (*PlatformAdapterTelegram) Serve

func (pa *PlatformAdapterTelegram) Serve() int

func (*PlatformAdapterTelegram) SetEnable

func (pa *PlatformAdapterTelegram) SetEnable(enable bool)

func (*PlatformAdapterTelegram) SetGroupCardName

func (pa *PlatformAdapterTelegram) SetGroupCardName(_ *MsgContext, _ string)

SetGroupCardName 没有这个接口 不实现

type PlatformAdapterWalleQ

type PlatformAdapterWalleQ struct {
	EndPoint        *EndPointInfo       `yaml:"-" json:"-"`
	Session         *IMSession          `yaml:"-" json:"-"`
	Socket          *gowebsocket.Socket `yaml:"-" json:"-"`
	ConnectURL      string              `yaml:"connectUrl" json:"connectUrl"`           // 连接地址
	UseInPackWalleQ bool                `yaml:"useInPackWalleQ" json:"useInPackWalleQ"` // 是否使用内置的WalleQ
	WalleQState     int                 `yaml:"-" json:"loginState"`                    // 当前状态
	CurLoginIndex   int                 `yaml:"-" json:"curLoginIndex"`                 // 当前登录序号,如果正在进行的登录不是该Index,证明过时

	WalleQProcess           *procs.Process `yaml:"-" json:"-"`
	WalleQLoginFailedReason string         `yaml:"-" json:"curLoginFailedReason"` // 当前登录失败原因

	WalleQLoginVerifyCode    string `yaml:"-" json:"WalleQLoginVerifyCode"`
	WalleQLoginDeviceLockURL string `yaml:"-" json:"WalleQLoginDeviceLockUrl"`
	WalleQQrcodeData         []byte `yaml:"-" json:"-"` // 二维码数据

	WalleQLastAutoLoginTime  int64 `yaml:"inPackGoCqLastAutoLoginTime" json:"-"`                         // 上次自动重新登录的时间
	WalleQLoginSucceeded     bool  `yaml:"inPackWalleQLoginSucceeded" json:"-"`                          // 是否登录成功过
	WalleQLastRestrictedTime int64 `yaml:"inPackWalleQLastRestricted" json:"inPackWalleQLastRestricted"` // 上次风控时间

	InPackWalleQProtocol       int      `yaml:"inPackWalleQProtocol" json:"inPackWalleQProtocol"`
	InPackWalleQPassword       string   `yaml:"inPackWalleQPassword" json:"-"`
	DiceServing                bool     `yaml:"-"`                                              // 是否正在连接中
	InPackWalleQDisconnectedCH chan int `yaml:"-" json:"-"`                                     // 信号量,用于关闭连接
	IgnoreFriendRequest        bool     `yaml:"ignoreFriendRequest" json:"ignoreFriendRequest"` // 忽略好友请求处理开关

	FileMap        *SyncMap[string, string] // 记录上传文件后得到的 id
	Implementation string                   `yaml:"implementation" json:"implementation"`
	// contains filtered or unexported fields
}

func (*PlatformAdapterWalleQ) DeleteFriend

func (pa *PlatformAdapterWalleQ) DeleteFriend(_ *MsgContext, id string)

DeleteFriend 删除好友

func (*PlatformAdapterWalleQ) DoRelogin

func (pa *PlatformAdapterWalleQ) DoRelogin() bool

func (*PlatformAdapterWalleQ) EditMessage

func (pa *PlatformAdapterWalleQ) EditMessage(_ *MsgContext, _, _ string)

func (*PlatformAdapterWalleQ) GetGroupInfoAsync

func (pa *PlatformAdapterWalleQ) GetGroupInfoAsync(id string)

func (*PlatformAdapterWalleQ) GetGroupMemberInfo

func (pa *PlatformAdapterWalleQ) GetGroupMemberInfo(groupID string, userID string) *OnebotV12UserInfo

GetGroupMemberInfo 获取群成员信息

func (*PlatformAdapterWalleQ) GetLoginInfo

func (pa *PlatformAdapterWalleQ) GetLoginInfo()

GetLoginInfo 获取登录号信息

func (*PlatformAdapterWalleQ) IsInLogin

func (pa *PlatformAdapterWalleQ) IsInLogin() bool

func (*PlatformAdapterWalleQ) IsLoginSuccessed

func (pa *PlatformAdapterWalleQ) IsLoginSuccessed() bool

func (*PlatformAdapterWalleQ) MemberBan

func (pa *PlatformAdapterWalleQ) MemberBan(groupID string, userID string, last int64)

func (*PlatformAdapterWalleQ) MemberKick

func (pa *PlatformAdapterWalleQ) MemberKick(groupID string, userID string)

func (*PlatformAdapterWalleQ) QuitGroup

func (pa *PlatformAdapterWalleQ) QuitGroup(_ *MsgContext, id string)

func (*PlatformAdapterWalleQ) RecallMessage

func (pa *PlatformAdapterWalleQ) RecallMessage(_ *MsgContext, _ string)

func (*PlatformAdapterWalleQ) SendFileToGroup

func (pa *PlatformAdapterWalleQ) SendFileToGroup(ctx *MsgContext, groupID string, path string, flag string)

func (*PlatformAdapterWalleQ) SendFileToPerson

func (pa *PlatformAdapterWalleQ) SendFileToPerson(ctx *MsgContext, userID string, path string, flag string)

func (*PlatformAdapterWalleQ) SendMessage

func (pa *PlatformAdapterWalleQ) SendMessage(text string, ty string, id string, cid string)

SendMessage 原始的发消息 API

func (*PlatformAdapterWalleQ) SendSegmentToGroup

func (pa *PlatformAdapterWalleQ) SendSegmentToGroup(ctx *MsgContext, groupID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterWalleQ) SendSegmentToPerson

func (pa *PlatformAdapterWalleQ) SendSegmentToPerson(ctx *MsgContext, userID string, msg []message.IMessageElement, flag string)

func (*PlatformAdapterWalleQ) SendToGroup

func (pa *PlatformAdapterWalleQ) SendToGroup(ctx *MsgContext, groupID string, text string, flag string)

func (*PlatformAdapterWalleQ) SendToPerson

func (pa *PlatformAdapterWalleQ) SendToPerson(ctx *MsgContext, userID string, text string, flag string)

func (*PlatformAdapterWalleQ) Serve

func (pa *PlatformAdapterWalleQ) Serve() int

func (*PlatformAdapterWalleQ) SetEnable

func (pa *PlatformAdapterWalleQ) SetEnable(enable bool)

func (*PlatformAdapterWalleQ) SetFriendAddRequest

func (pa *PlatformAdapterWalleQ) SetFriendAddRequest(reqID int64, userID string, accept bool)

SetFriendAddRequest 同意好友

func (*PlatformAdapterWalleQ) SetGroupAddRequest

func (pa *PlatformAdapterWalleQ) SetGroupAddRequest(rid int64, gid string, accept bool)

SetGroupAddRequest 同意加群

func (*PlatformAdapterWalleQ) SetGroupCardName

func (pa *PlatformAdapterWalleQ) SetGroupCardName(_ *MsgContext, _ string)

func (*PlatformAdapterWalleQ) SetQQProtocol

func (pa *PlatformAdapterWalleQ) SetQQProtocol(protocol int) bool

func (*PlatformAdapterWalleQ) TextToMessageSegment

func (pa *PlatformAdapterWalleQ) TextToMessageSegment(text string) []MessageSegment

func (*PlatformAdapterWalleQ) UpVoiceFile

func (pa *PlatformAdapterWalleQ) UpVoiceFile(path string)

type PlayerVariablesItem

type PlayerVariablesItem model.PlayerVariablesItem

func LoadPlayerGlobalVars

func LoadPlayerGlobalVars(s *IMSession, id string) *PlayerVariablesItem

func LoadPlayerGroupVars

func LoadPlayerGroupVars(dice *Dice, group *GroupInfo, player *GroupPlayerInfo) *PlayerVariablesItem

type PluginConfig

type PluginConfig struct {
	PluginName        string                 `json:"pluginName"`
	Configs           map[string]*ConfigItem `json:"configs" jsbind:"configs"`
	OrderedConfigKeys []string               `json:"orderedConfigKeys" jsbind:"orderedConfigKeys"`
}

type PrinterFunc

type PrinterFunc struct {
	// contains filtered or unexported fields
}

func (*PrinterFunc) Error

func (p *PrinterFunc) Error(s string)

func (*PrinterFunc) Log

func (p *PrinterFunc) Log(s string)

func (*PrinterFunc) RecordEnd

func (p *PrinterFunc) RecordEnd() []string

func (*PrinterFunc) RecordStart

func (p *PrinterFunc) RecordStart()

func (*PrinterFunc) Warn

func (p *PrinterFunc) Warn(s string)

type ProcessExitGroup

type ProcessExitGroup uintptr

func NewProcessExitGroup

func NewProcessExitGroup() (ProcessExitGroup, error)

func (ProcessExitGroup) AddProcess

func (g ProcessExitGroup) AddProcess(_ *os.Process) error

func (ProcessExitGroup) Dispose

func (g ProcessExitGroup) Dispose() error

type Prop

type Prop struct {
	Key   string `json:"key"`
	Value string `json:"value"`

	Name     string `json:"name"`
	Desc     string `json:"desc"`
	Required bool   `json:"required"`
	Default  string `json:"default"`
}

type ProtocolType

type ProtocolType int
const (
	AndroidPhone ProtocolType = 1 // Android Phone
	AndroidPad   ProtocolType = 6 // Android Pad
)

type QQUidType

type QQUidType int
const (
	QQUidPerson        QQUidType = 1
	QQUidGroup         QQUidType = 2
	QQUidChannelPerson QQUidType = 3
	QQUidChannelGroup  QQUidType = 4
)

type RIListItem

type RIListItem struct {
	// contains filtered or unexported fields
}

type RedChatType

type RedChatType int
const (
	PersonChat RedChatType = 1
	GroupChat  RedChatType = 2
)

type RedConnectReq

type RedConnectReq struct {
	Token string `json:"token"`
}

type RedConnectResp

type RedConnectResp struct {
	Version  string `json:"version"`
	Name     string `json:"name"`
	AuthData *struct {
		Account     string `json:"account"`
		MainAccount string `json:"mainAccount"`
		Uin         string `json:"uin"`
		Uid         string `json:"uid"`
		NickName    string `json:"nickName"`
		Gender      int    `json:"gender"`
		Age         int    `json:"age"`
		FaceUrl     string `json:"faceUrl"`
		A2          string `json:"a2"`
		D2          string `json:"d2"`
		D2key       string `json:"d2Key"`
	} `json:"authData"`
}

type RedElement

type RedElement struct {
	ElementType     int             `json:"elementType,omitempty"`
	ElementId       string          `json:"elementId,omitempty"`
	ExtBufForUI     string          `json:"extBufForUI,omitempty"`
	PicElement      *RedPicElement  `json:"picElement,omitempty"`
	TextElement     *RedTextElement `json:"textElement,omitempty"`
	ArkElement      interface{}     `json:"arkElement,omitempty"`
	AvRecordElement interface{}     `json:"avRecordElement,omitempty"`
	CalendarElement interface{}     `json:"calendarElement,omitempty"`
	FaceElement     interface{}     `json:"faceElement,omitempty"`
	FileElement     *RedFileElement `json:"fileElement,omitempty"`
	GiphyElement    interface{}     `json:"giphyElement,omitempty"`
	GrayTipElement  *struct {
		XmlElement          *RedXMLElement `json:"xmlElement,omitempty"`
		AioOpGrayTipElement interface{}    `json:"aioOpGrayTipElement,omitempty"`
		BlockGrayTipElement interface{}    `json:"blockGrayTipElement,omitempty"`
		BuddyElement        interface{}    `json:"buddyElement,omitempty"`
		BuddyNotifyElement  interface{}    `json:"buddyNotifyElement,omitempty"`
		EmojiReplyElement   interface{}    `json:"emojiReplyElement,omitempty"`
		EssenceElement      interface{}    `json:"essenceElement,omitempty"`
		FeedMsgElement      interface{}    `json:"feedMsgElement,omitempty"`
		FileReceiptElement  interface{}    `json:"fileReceiptElement,omitempty"`
		GroupElement        interface{}    `json:"groupElement,omitempty"`
		GroupNotifyElement  interface{}    `json:"groupNotifyElement,omitempty"`
		JsonGrayTipElement  interface{}    `json:"jsonGrayTipElement,omitempty"`
		LocalGrayTipElement interface{}    `json:"localGrayTipElement,omitempty"`
		ProclamationElement interface{}    `json:"proclamationElement,omitempty"`
		RevokeElement       interface{}    `json:"revokeElement,omitempty"`
		SubElementType      interface{}    `json:"subElementType,omitempty"`
	} `json:"grayTipElement,omitempty"`
	InlineKeyboardElement  interface{} `json:"inlineKeyboardElement,omitempty"`
	LiveGiftElement        interface{} `json:"liveGiftElement,omitempty"`
	MarkdownElement        interface{} `json:"markdownElement,omitempty"`
	MarketFaceElement      interface{} `json:"marketFaceElement,omitempty"`
	MultiForwardMsgElement interface{} `json:"multiForwardMsgElement,omitempty"`
	PttElement             interface{} `json:"pttElement,omitempty"`
	ReplyElement           interface{} `json:"replyElement,omitempty"`
	StructLongMsgElement   interface{} `json:"structLongMsgElement,omitempty"`
	TextGiftElement        interface{} `json:"textGiftElement,omitempty"`
	VideoElement           interface{} `json:"videoElement,omitempty"`
	WalletElement          interface{} `json:"walletElement,omitempty"`
	YoloGameResultElement  interface{} `json:"yoloGameResultElement,omitempty"`
}

type RedEmojiAd

type RedEmojiAd struct {
	Url  string `json:"url,omitempty"`
	Desc string `json:"desc,omitempty"`
}

type RedEmojiMall

type RedEmojiMall struct {
	PackageId int `json:"packageId,omitempty"`
	EmojiId   int `json:"emojiId,omitempty"`
}

type RedEmojiZplan

type RedEmojiZplan struct {
	ActionId         int    `json:"actionId,omitempty"`
	ActionName       string `json:"actionName,omitempty"`
	ActionType       int    `json:"actionType,omitempty"`
	PlayerNumber     int    `json:"playerNumber,omitempty"`
	PeerUid          string `json:"peerUid,omitempty"`
	BytesReserveInfo string `json:"bytesReserveInfo,omitempty"`
}

type RedFileElement

type RedFileElement struct {
	FileMd5       string      `json:"fileMd5,omitempty"`
	FileSize      int64       `json:"fileSize,omitempty"`
	FileName      string      `json:"fileName,omitempty"`
	FilePath      string      `json:"filePath,omitempty"`
	PicWidth      int64       `json:"picWidth,omitempty"`
	PicHeight     int64       `json:"picHeight,omitempty"`
	PicThumbPath  interface{} `json:"thumbPath,omitempty"`
	File10MMd5    string      `json:"file10MMd5,omitempty"`
	FileSha       string      `json:"fileSha,omitempty"`
	FileSha3      string      `json:"fileSha3,omitempty"`
	FileUuid      string      `json:"fileUuid,omitempty"`
	FileSubId     string      `json:"fileSubId,omitempty"`
	ThumbFileSize int64       `json:"thumbFileSize,omitempty"`
}

type RedImageUploadInfo

type RedImageUploadInfo struct {
	Width  int64  `json:"width"`
	Height int64  `json:"height"`
	Type   string `json:"type"`
	Mime   string `json:"mime"`
	WUnits string `json:"wUnits"`
	HUnits string `json:"hUnits"`
}

type RedMessage

type RedMessage struct {
	MsgID               string        `json:"msgId"`
	MsgRandom           string        `json:"msgRandom"`
	MsgSeq              string        `json:"msgSeq"`
	CntSeq              string        `json:"cntSeq"`
	ChatType            int           `json:"chatType"`
	MsgType             int           `json:"msgType"`
	SubMsgType          int           `json:"subMsgType"`
	SendType            int           `json:"sendType"`
	SenderUid           string        `json:"senderUid"`
	PeerUid             string        `json:"peerUid"`
	ChannelId           string        `json:"channelId"`
	GuildId             string        `json:"guildId"`
	GuildCode           string        `json:"guildCode"`
	FromUid             string        `json:"fromUid"`
	FromAppid           string        `json:"fromAppid"`
	MsgTime             string        `json:"msgTime"`
	MsgMeta             string        `json:"msgMeta"`
	SendStatus          int           `json:"sendStatus"`
	SendMemberName      string        `json:"sendMemberName"`
	SendNickName        string        `json:"sendNickName"`
	GuildName           string        `json:"guildName"`
	ChannelName         string        `json:"channelName"`
	Elements            []*RedElement `json:"elements"`
	Records             []interface{} `json:"records"`
	EmojiLikesList      []interface{} `json:"emojiLikesList"`
	CommentCnt          string        `json:"commentCnt"`
	DirectMsgFlag       int           `json:"directMsgFlag"`
	DirectMsgMembers    []interface{} `json:"directMsgMembers"`
	PeerName            string        `json:"peerName"`
	Editable            bool          `json:"editable"`
	AvatarMeta          string        `json:"avatarMeta"`
	AvatarPendant       string        `json:"avatarPendant"`
	FeedId              string        `json:"feedId"`
	RoleId              string        `json:"roleId"`
	TimeStamp           string        `json:"timeStamp"`
	IsImportMsg         bool          `json:"isImportMsg"`
	AtType              int           `json:"atType"`
	RoleType            int           `json:"roleType"`
	FromChannelRoleInfo *RedRoleInfo  `json:"fromChannelRoleInfo"`
	FromGuildRoleInfo   *RedRoleInfo  `json:"fromGuildRoleInfo"`
	LevelRoleInfo       *RedRoleInfo  `json:"levelRoleInfo"`
	RecallTime          string        `json:"recallTime"`
	IsOnlineMsg         bool          `json:"isOnlineMsg"`
	GeneralFlags        string        `json:"generalFlags"`
	ClientSeq           string        `json:"clientSeq"`
	NameType            int           `json:"nameType"`
	AvatarFlag          int           `json:"avatarFlag"`
	SenderUin           string        `json:"senderUin"`
	PeerUin             string        `json:"peerUin"`
}

type RedMessageRecv

type RedMessageRecv []*RedMessage

type RedMessageSend

type RedMessageSend struct {
	Peer     *RedPeer      `json:"peer"`
	Elements []*RedElement `json:"elements"`
}

type RedPack

type RedPack[T interface{}] struct {
	Type    string `json:"type"`
	Payload *T     `json:"payload"`
}

type RedPeer

type RedPeer struct {
	ChatType RedChatType `json:"chatType"` // Group: 2
	PeerUin  string      `json:"peerUin"`
	GuildId  string      `json:"guildId,omitempty"` // 一直为 Null
}

type RedPicElement

type RedPicElement struct {
	PicSubType     int            `json:"picSubType,omitempty"`
	FileName       string         `json:"fileName,omitempty"`
	FileSize       string         `json:"fileSize,omitempty"`
	PicWidth       int64          `json:"picWidth,omitempty"`
	PicHeight      int64          `json:"picHeight,omitempty"`
	Original       bool           `json:"original,omitempty"`
	Md5HexStr      string         `json:"md5HexStr,omitempty"`
	SourcePath     string         `json:"sourcePath,omitempty"`
	ThumbPath      *RedThumbPath  `json:"thumbPath,omitempty"`
	TransferStatus int            `json:"transferStatus,omitempty"`
	Progress       int            `json:"progress,omitempty"`
	PicType        int            `json:"picType,omitempty"`
	InvalidState   int            `json:"invalidState,omitempty"`
	FileUuid       string         `json:"fileUuid,omitempty"`
	FileSubId      string         `json:"fileSubId,omitempty"`
	ThumbFileSize  int            `json:"thumbFileSize,omitempty"`
	Summary        string         `json:"summary,omitempty"`
	EmojiAd        *RedEmojiAd    `json:"emojiAd,omitempty"`
	EmojiMall      *RedEmojiMall  `json:"emojiMall,omitempty"`
	EmojiZplan     *RedEmojiZplan `json:"emojiZplan,omitempty"`
	OriginImageUrl string         `json:"originImageUrl,omitempty"`
}

type RedRichMediaResp

type RedRichMediaResp struct {
	Md5        string              `json:"md5"`
	FileSize   int64               `json:"fileSize"`
	FilePath   string              `json:"filePath"`
	NtFilePath string              `json:"ntFilePath"`
	ImageInfo  *RedImageUploadInfo `json:"imageInfo"`
}

type RedRoleInfo

type RedRoleInfo struct {
	RoleId string `json:"roleId"`
	Name   string `json:"name"`
	Color  int    `json:"color"`
}

type RedTextElement

type RedTextElement struct {
	Content        string `json:"content,omitempty"`
	AtType         int    `json:"atType,omitempty"`
	AtUid          string `json:"atUid,omitempty"`
	AtTinyId       string `json:"atTinyId,omitempty"`
	AtNtUid        string `json:"atNtUid,omitempty"`
	SubElementType int    `json:"subElementType,omitempty"`
	AtChannelId    string `json:"atChannelId,omitempty"`
	AtRoleId       string `json:"atRoleId,omitempty"`
	AtRoleColor    int    `json:"atRoleColor,omitempty"`
	AtRoleName     string `json:"atRoleName,omitempty"`
	NeedNotify     int    `json:"needNotify,omitempty"`
	AtNtUin        string `json:"atNtUin,omitempty"`
}

type RedThumbPath

type RedThumbPath struct {
}

type RedXMLElement

type RedXMLElement struct {
	BusiType    string `json:"busiType,omitempty"`
	BusiId      string `json:"busiId,omitempty"`
	C2cType     int    `json:"c2CType,omitempty"`
	ServiceType int    `json:"serviceType,omitempty"`
	CtrlFlag    int    `json:"ctrlFlag,omitempty"`
	Content     string `json:"content,omitempty"`
	TemplId     string `json:"templId,omitempty"`
	SeqId       string `json:"seqId,omitempty"`
	TemplParam  any    `json:"templParam,omitempty"`
	PbReserv    string `json:"pbReserv,omitempty"`
	Members     any    `json:"members,omitempty"`
}

type ReplyConditionBase

type ReplyConditionBase interface {
	Check(ctx *MsgContext, msg *Message, cmdArgs *CmdArgs, cleanText string) bool
	Clean()
}

type ReplyConditionExprTrue

type ReplyConditionExprTrue struct {
	CondType string `yaml:"condType" json:"condType"`
	Value    string `yaml:"value" json:"value"`
}

ReplyConditionExprTrue 表达式为真 // exprTrue

func (*ReplyConditionExprTrue) Check

func (m *ReplyConditionExprTrue) Check(ctx *MsgContext, _ *Message, _ *CmdArgs, _ string) bool

func (*ReplyConditionExprTrue) Clean

func (m *ReplyConditionExprTrue) Clean()

type ReplyConditionMultiMatch

type ReplyConditionMultiMatch struct {
	CondType  string `yaml:"condType" json:"condType"`
	MatchType string `yaml:"matchType" json:"matchType"`
	Value     string `yaml:"value" json:"value"`
}

ReplyConditionMultiMatch 文本多重匹配

type ReplyConditionTextLenLimit

type ReplyConditionTextLenLimit struct {
	CondType string `yaml:"condType" json:"condType"`
	MatchOp  string `yaml:"matchOp" json:"matchOp"` // 其实是ge或le
	Value    int    `yaml:"value" json:"value"`
}

ReplyConditionTextLenLimit 文本长度限制 // textLenLimit

func (*ReplyConditionTextLenLimit) Check

func (m *ReplyConditionTextLenLimit) Check(_ *MsgContext, _ *Message, _ *CmdArgs, cleanText string) bool

func (*ReplyConditionTextLenLimit) Clean

func (m *ReplyConditionTextLenLimit) Clean()

type ReplyConditionTextMatch

type ReplyConditionTextMatch struct {
	CondType  string `yaml:"condType" json:"condType"`
	MatchType string `yaml:"matchType" json:"matchType"` // matchExact 精确  matchRegex 正则 matchFuzzy 模糊 matchContains 包含
	Value     string `yaml:"value" json:"value"`
}

ReplyConditionTextMatch 文本匹配 // textMatch

func (*ReplyConditionTextMatch) Check

func (m *ReplyConditionTextMatch) Check(ctx *MsgContext, _ *Message, _ *CmdArgs, cleanText string) bool

func (*ReplyConditionTextMatch) Clean

func (m *ReplyConditionTextMatch) Clean()

type ReplyConditions

type ReplyConditions []ReplyConditionBase

func (*ReplyConditions) UnmarshalJSON

func (cond *ReplyConditions) UnmarshalJSON(data []byte) error

func (*ReplyConditions) UnmarshalYAML

func (cond *ReplyConditions) UnmarshalYAML(data *yaml.Node) error

type ReplyConfig

type ReplyConfig struct {
	Enable   bool         `yaml:"enable" json:"enable"`
	Interval float64      `yaml:"interval" json:"interval"` // 响应间隔,最少为5
	Items    []*ReplyItem `yaml:"items" json:"items"`

	// 作者信息
	Name            string   `yaml:"name" json:"name"`
	Author          []string `yaml:"author" json:"author"`
	Version         string   `yaml:"version" json:"version"`
	CreateTimestamp int64    `yaml:"createTimestamp" json:"createTimestamp"`
	UpdateTimestamp int64    `yaml:"updateTimestamp" json:"updateTimestamp"`
	Desc            string   `yaml:"desc" json:"desc"`

	// 文件级别执行条件
	Conditions ReplyConditions `yaml:"conditions" json:"conditions"`

	// web专用
	Filename string `yaml:"-" json:"filename"`
}

func CustomReplyConfigNew

func CustomReplyConfigNew(dice *Dice, filename string) *ReplyConfig

func CustomReplyConfigRead

func CustomReplyConfigRead(dice *Dice, filename string) (*ReplyConfig, error)

func (*ReplyConfig) Clean

func (c *ReplyConfig) Clean()

func (*ReplyConfig) Save

func (c *ReplyConfig) Save(dice *Dice)

type ReplyItem

type ReplyItem struct {
	Enable     bool              `yaml:"enable" json:"enable"`
	Conditions ReplyConditions   `yaml:"conditions" json:"conditions"`
	Results    []ReplyResultBase `yaml:"results" json:"results"`
}

func (*ReplyItem) UnmarshalJSON

func (ri *ReplyItem) UnmarshalJSON(data []byte) error

func (*ReplyItem) UnmarshalYAML

func (ri *ReplyItem) UnmarshalYAML(value *yaml.Node) error

type ReplyResultBase

type ReplyResultBase interface {
	Execute(ctx *MsgContext, msg *Message, cmdArgs *CmdArgs)
	Clean()
}

type ReplyResultReplyGroup

type ReplyResultReplyGroup struct {
	ResultType string                `yaml:"resultType" json:"resultType"`
	Delay      float64               `yaml:"delay" json:"delay"`
	Message    *TextTemplateItemList `yaml:"message" json:"message"`
}

ReplyResultReplyGroup 回复到群组 replyGroup

func (*ReplyResultReplyGroup) Clean

func (m *ReplyResultReplyGroup) Clean()

func (*ReplyResultReplyGroup) Execute

func (m *ReplyResultReplyGroup) Execute(ctx *MsgContext, msg *Message, _ *CmdArgs)

type ReplyResultReplyPrivate

type ReplyResultReplyPrivate struct {
	ResultType string               `yaml:"resultType" json:"resultType"`
	Delay      float64              `yaml:"delay" json:"delay"`
	Message    TextTemplateItemList `yaml:"message" json:"message"`
}

ReplyResultReplyPrivate 回复到私人 replyPrivate

func (*ReplyResultReplyPrivate) Clean

func (m *ReplyResultReplyPrivate) Clean()

func (*ReplyResultReplyPrivate) Execute

func (m *ReplyResultReplyPrivate) Execute(ctx *MsgContext, msg *Message, _ *CmdArgs)

type ReplyResultReplyToSender

type ReplyResultReplyToSender struct {
	ResultType string               `yaml:"resultType" json:"resultType"`
	Delay      float64              `yaml:"delay" json:"delay"`
	Message    TextTemplateItemList `yaml:"message" json:"message"`
}

ReplyResultReplyToSender replyToSender

func (*ReplyResultReplyToSender) Clean

func (m *ReplyResultReplyToSender) Clean()

func (*ReplyResultReplyToSender) Execute

func (m *ReplyResultReplyToSender) Execute(ctx *MsgContext, msg *Message, _ *CmdArgs)

type ReplyResultRunText

type ReplyResultRunText struct {
	ResultType string  `yaml:"resultType" json:"resultType"`
	Delay      float64 `yaml:"delay" json:"delay"`
	Message    string  `yaml:"message" json:"message"`
}

ReplyResultRunText 同.text,但无输出 runText

func (*ReplyResultRunText) Execute

func (m *ReplyResultRunText) Execute(ctx *MsgContext, _ *Message, _ *CmdArgs)

type RequestFileDataImpl

type RequestFileDataImpl struct {
	Reader io.Reader
	File   string
}

func (*RequestFileDataImpl) NeedsUpload

func (r *RequestFileDataImpl) NeedsUpload() bool

func (*RequestFileDataImpl) SendData

func (r *RequestFileDataImpl) SendData() string

func (*RequestFileDataImpl) UploadData

func (r *RequestFileDataImpl) UploadData() (string, io.Reader, error)

type RollExpression

type RollExpression struct {
	Code             []ByteCode
	Top              int
	CocFlagVarPrefix string // 解析过程中出现,当VarNumber开启时有效,可以是困难极难常规大成功

	NumOpCount int64 // 算力计数

	JmpStack     []int
	CounterStack []int64

	Error        error
	TmpCodeStack []int // 目前专用于computed,处理codepush
	Calculated   bool  // 是否经过计算,如骰点和符号运算
	// contains filtered or unexported fields
}

func (*RollExpression) AddFormatString

func (e *RollExpression) AddFormatString(value string, num int64)

func (*RollExpression) AddLeftValueMark

func (e *RollExpression) AddLeftValueMark()

func (*RollExpression) AddLoadVarname

func (e *RollExpression) AddLoadVarname(value string)

func (*RollExpression) AddLoadVarnameForThis

func (e *RollExpression) AddLoadVarnameForThis(value string)

func (*RollExpression) AddOperator

func (e *RollExpression) AddOperator(operator Type) int

func (*RollExpression) AddOperatorWithInt64

func (e *RollExpression) AddOperatorWithInt64(operator Type, val int64)

func (*RollExpression) AddStModify

func (e *RollExpression) AddStModify(op string, text string)

func (*RollExpression) AddStName

func (e *RollExpression) AddStName()

func (*RollExpression) AddStore

func (e *RollExpression) AddStore()

func (*RollExpression) AddStoreComputed

func (e *RollExpression) AddStoreComputed(text string)

func (*RollExpression) AddValue

func (e *RollExpression) AddValue(value string)

func (*RollExpression) AddValueStr

func (e *RollExpression) AddValueStr(value string)

func (*RollExpression) CodePop

func (e *RollExpression) CodePop()

func (*RollExpression) CodePush

func (e *RollExpression) CodePush()

func (*RollExpression) CounterAdd

func (e *RollExpression) CounterAdd(offset int64)

func (*RollExpression) CounterPop

func (e *RollExpression) CounterPop() int64

func (*RollExpression) CounterPush

func (e *RollExpression) CounterPush()

func (*RollExpression) Evaluate

func (e *RollExpression) Evaluate(_ *Dice, ctx *MsgContext) (*VMStack, string, error)

func (*RollExpression) GetAsmText

func (e *RollExpression) GetAsmText() string

func (*RollExpression) Init

func (e *RollExpression) Init(stackLength int)

func (*RollExpression) PopAndSetOffset

func (e *RollExpression) PopAndSetOffset()

func (*RollExpression) PushForOffset

func (e *RollExpression) PushForOffset()

func (*RollExpression) WriteCode

func (e *RollExpression) WriteCode(t Type, value int64, valueStr string)

type RollExtraFlags

type RollExtraFlags struct {
	BigFailDiceOn      bool
	DisableLoadVarname bool  // 不允许加载变量,这是为了防止遇到 .r XXX 被当做属性读取,而不是“由于XXX,骰出了”
	CocVarNumberMode   bool  // 特殊的变量模式,此时这种类型的变量“力量50”被读取为50,而解析的文本被算作“力量”,如果没有后面的数字则正常进行
	CocDefaultAttrOn   bool  // 启用COC的默认属性值,如攀爬20等
	IgnoreDiv0         bool  // 当div0时暂不报错
	DisableValueBuff   bool  // 不计算buff值
	DNDAttrReadMod     bool  // 基础属性被读取为调整值,仅在检定时使用
	DNDAttrReadDC      bool  // 将力量豁免读取为力量再计算豁免值
	DefaultDiceSideNum int64 // 默认骰子面数
	DisableBitwiseOp   bool  // 禁用位运算,用于st
	DisableBlock       bool  // 禁用语句块(实际还禁用赋值语句,暂定名如此)
	DisableNumDice     bool  // 禁用r2d语法
	DisableBPDice      bool  // 禁用bp语法
	DisableCrossDice   bool  // 禁用双十字骰
	DisableDicePool    bool  // 禁用骰池

	StCallback func(_type string, name string, val *VMValue, op string, detail string) // st回调
	// contains filtered or unexported fields
}

type SatoriArgv

type SatoriArgv struct {
	Name      string        `json:"name"`
	Arguments []interface{} `json:"arguments"`
	Options   interface{}   `json:"options"`
}

type SatoriButton

type SatoriButton struct {
	ID string `json:"id"`
}

type SatoriChannel

type SatoriChannel struct {
	ID       string            `json:"id"`
	Type     SatoriChannelType `json:"type"`
	Name     string            `json:"name"`
	ParentID string            `json:"parent_id"`
}

type SatoriChannelType

type SatoriChannelType int
const (
	SatoriTextChannel     SatoriChannelType = iota // 文本频道
	SatoriDirectChannel                            // 私聊频道
	SatoriCategoryChannel                          // 分类频道
	SatoriVoiceChannel                             // 语音频道
)

type SatoriEvent

type SatoriEvent struct {
	ID        json.Number        `json:"id"`
	Type      string             `json:"type"`
	Platform  string             `json:"platform"`
	SelfID    string             `json:"self_id"`
	Timestamp int64              `json:"timestamp"`
	Argv      *SatoriArgv        `json:"argv"`
	Button    *SatoriButton      `json:"button"`
	Channel   *SatoriChannel     `json:"channel"`
	Guild     *SatoriGuild       `json:"guild"`
	Login     *SatoriLogin       `json:"login"`
	Member    *SatoriGuildMember `json:"member"`
	Message   *SatoriMessage     `json:"message"`
	Operator  *SatoriUser        `json:"operator"`
	Role      *SatoriGuildRole   `json:"role"`
	User      *SatoriUser        `json:"user"`
}

type SatoriGuild

type SatoriGuild struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Avatar string `json:"avatar"`
}

type SatoriGuildMember

type SatoriGuildMember struct {
	User     *SatoriUser `json:"user"`
	Nick     string      `json:"nick"`
	Avatar   string      `json:"avatar"`
	JoinedAt int64       `json:"joined_at"`
}

type SatoriGuildRole

type SatoriGuildRole struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type SatoriIdentify

type SatoriIdentify struct {
	Token    string `json:"token"`
	Sequence int64  `json:"sequence"`
}

type SatoriLogin

type SatoriLogin struct {
	User     *SatoriUser  `json:"user"`
	SelfID   string       `json:"self_id"`
	Platform string       `json:"platform"`
	Status   SatoriStatus `json:"status"`
}

type SatoriMessage

type SatoriMessage struct {
	ID        string             `json:"id"`
	Content   string             `json:"content"`
	Channel   *SatoriChannel     `json:"channel"`
	Guild     *SatoriGuild       `json:"guild"`
	Member    *SatoriGuildMember `json:"member"`
	User      *SatoriUser        `json:"user"`
	CreatedAt int64              `json:"created_at"`
	UpdatedAt int64              `json:"updated_at"`
}

type SatoriOpCode

type SatoriOpCode int
const (
	SatoriOpEvent SatoriOpCode = iota
	SatoriOpPing
	SatoriOpPong
	SatoriOpIdentify
	SatoriOpReady
)

type SatoriPayload

type SatoriPayload[T SatoriIdentify | SatoriReady | SatoriEvent | any] struct {
	Op   SatoriOpCode `json:"op"`
	Body *T           `json:"body"`
}

type SatoriReady

type SatoriReady struct {
	Logins []*SatoriLogin `json:"logins"`
}

type SatoriStatus

type SatoriStatus int
const (
	SatoriOffline SatoriStatus = iota
	SatoriOnline
	SatoriConnect
	SatoriDisconnect
	SatoriReconnect
)

type SatoriUser

type SatoriUser struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Nick   string `json:"nick"`
	Avatar string `json:"avatar"`
	IsBot  bool   `json:"is_bot"`
}

type SealComplexSingleDeck

type SealComplexSingleDeck struct {
	Export  bool     `toml:"export" mapstructure:"export"`
	Visible bool     `toml:"visible" mapstructure:"visible"`
	Aliases []string `toml:"aliases" mapstructure:"aliases"`
	Replace bool     `toml:"replace" mapstructure:"replace"` // 是否放回

	// 文本牌组项
	Options []string `toml:"options" mapstructure:"options"`

	// 云牌组项
	CloudExtra  bool     `toml:"cloud_extra" mapstructure:"cloud_extra"`
	Distinct    bool     `toml:"distinct" mapstructure:"distinct"`
	OptionsUrls []string `toml:"options_urls" mapstructure:"options_urls"`
}

type SealMeta

type SealMeta struct {
	Title         string    `toml:"title"`
	Author        string    `toml:"author"`
	Authors       []string  `toml:"authors"`
	Version       string    `toml:"version"`
	License       string    `toml:"license"`
	Date          time.Time `toml:"date"`
	UpdateDate    time.Time `toml:"update_date"`
	Desc          string    `toml:"desc"`
	FormatVersion int64     `toml:"format_version"`

	UpdateUrls []string `toml:"update_urls"`
	Etag       string   `toml:"etag"`
}

type Self

type Self struct {
	Platform string `json:"platform"`
	UserID   string `json:"user_id"`
}

type SendMessageMinecraft

type SendMessageMinecraft struct {
	Content     string `json:"content"`
	Name        string `json:"name"`
	UUID        string `json:"uuid"`
	MessageType string `json:"messageType"`
}

type Sender

type Sender struct {
	Age      int32           `json:"age"`
	Card     string          `json:"card"`
	Nickname string          `json:"nickname"`
	Role     string          `json:"role"` // owner 群主
	UserID   json.RawMessage `json:"user_id"`
}

type SenderBase

type SenderBase struct {
	Nickname  string `json:"nickname" jsbind:"nickname"`
	UserID    string `json:"userId" jsbind:"userId"`
	GroupRole string `json:"-"` // 群内角色 admin管理员 owner群主
}

type SenderChannel

type SenderChannel struct {
	Nickname string `json:"nickname"`
	UserID   string `json:"tiny_id"`
}

type SetConfig

type SetConfig struct {
	RelatedExt []string `yaml:"relatedExt" json:"relatedExt"` // 关联扩展
	DiceSides  int64    `yaml:"diceSides" json:"diceSides"`   // 骰子面数
	Keys       []string `yaml:"keys" json:"keys"`             // 可用于 .set xxx 的key
	EnableTip  string   `yaml:"enableTip" json:"enableTip"`   // 启用提示
}

type ShuffleRandomPool

type ShuffleRandomPool struct {
	// contains filtered or unexported fields
}

临时乱写的

func DeckToShuffleRandomPool

func DeckToShuffleRandomPool(deck []string) *ShuffleRandomPool

func NewChooser

func NewChooser(choices ...wr.Choice) (*ShuffleRandomPool, error)

func (*ShuffleRandomPool) Pick

func (c *ShuffleRandomPool) Pick() interface{}

Pick returns a single weighted random Choice.Item from the Chooser.

Utilizes global rand as the source of randomness.

type SignServer

type SignServer struct {
	URL           string `yaml:"url" json:"url"`
	Key           string `yaml:"key" json:"key"`
	Authorization string `yaml:"authorization" json:"authorization"`
}

type SignServerConfig

type SignServerConfig struct {
	SignServers          []*SignServer `yaml:"signServers" json:"signServers"`
	RuleChangeSignServer int           `yaml:"ruleChangeSignServer" json:"ruleChangeSignServer"`
	MaxCheckCount        int           `yaml:"maxCheckCount" json:"maxCheckCount"`
	SignServerTimeout    int           `yaml:"signServerTimeout" json:"signServerTimeout"`
	AutoRegister         bool          `yaml:"autoRegister" json:"autoRegister"`
	AutoRefreshToken     bool          `yaml:"autoRefreshToken" json:"autoRefreshToken"`
	RefreshInterval      int           `yaml:"refreshInterval" json:"refreshInterval"`
}

type SignStatus

type SignStatus int8
const (
	// ErrorSign 错误签名
	ErrorSign SignStatus = -1
	// UnknownSign 无签名
	UnknownSign SignStatus = 0
	// OfficialSign 官方签名
	OfficialSign SignStatus = 1
)

func CheckJsSign

func CheckJsSign(rawData []byte) (bool, SignStatus)

type StoryLogBackup

type StoryLogBackup struct {
	Name     string `json:"name"`
	FileSize int64  `json:"fileSize"`
}

func StoryLogBackupList

func StoryLogBackupList(d *Dice) ([]StoryLogBackup, error)

type SyncMap

type SyncMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*SyncMap[K, V]) Delete

func (m *SyncMap[K, V]) Delete(key K)

func (*SyncMap[K, V]) Exists

func (m *SyncMap[K, V]) Exists(key K) bool

func (*SyncMap[K, V]) Len

func (m *SyncMap[K, V]) Len() int

func (*SyncMap[K, V]) Load

func (m *SyncMap[K, V]) Load(key K) (value V, ok bool)

func (*SyncMap[K, V]) LoadAndDelete

func (m *SyncMap[K, V]) LoadAndDelete(key K) (value V, loaded bool)

func (*SyncMap[K, V]) LoadOrStore

func (m *SyncMap[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)

func (*SyncMap[K, V]) MarshalJSON

func (m *SyncMap[K, V]) MarshalJSON() ([]byte, error)

func (*SyncMap[K, V]) Range

func (m *SyncMap[K, V]) Range(f func(key K, value V) bool)

func (*SyncMap[K, V]) Store

func (m *SyncMap[K, V]) Store(key K, value V)

func (*SyncMap[K, V]) UnmarshalJSON

func (m *SyncMap[K, V]) UnmarshalJSON(b []byte) error

type TextTemplateHelpGroup

type TextTemplateHelpGroup = map[string]*TextTemplateHelpItem

type TextTemplateHelpItem

type TextTemplateHelpItem = struct {
	Filename        []string           `json:"filename"` // 文件名
	Origin          []TextTemplateItem `json:"origin"`   // 初始文本
	Vars            []string           `json:"vars"`     // 可用变量
	Commands        []string           `json:"commands"` // 所属指令
	Modified        bool               `json:"modified"` // 跟初始相比是否有修改
	SubType         string             `json:"subType"`
	ExtraText       string             `json:"extraText"`       // 额外解说
	ExampleCommands []string           `json:"exampleCommands"` // 案例命令
	NotBuiltin      bool               `json:"notBuiltin"`      // 非内置
	TopOrder        int                `json:"topOrder"`        // 置顶序号,越高越靠前
}

TextTemplateHelpItem 辅助信息,用于UI中,大部分自动生成

type TextTemplateItem

type TextTemplateItem = []interface{} // 实际上是 [](string | int) 类型

type TextTemplateWithWeight = map[string]map[string]uint

type TextTemplateItemList

type TextTemplateItemList []TextTemplateItem

type TextTemplateWithWeight = map[string]map[string]uint

func (*TextTemplateItemList) Clean

func (i *TextTemplateItemList) Clean()

type TextTemplateWithHelpDict

type TextTemplateWithHelpDict = map[string]TextTemplateHelpGroup

type TextTemplateWithWeight

type TextTemplateWithWeight = map[string][]TextTemplateItem

type TextTemplateWithWeightDict

type TextTemplateWithWeightDict = map[string]TextTemplateWithWeight

type Type

type Type uint8
const (
	TypePushNumber Type = iota
	TypePushString
	TypePushComputed
	TypeNegation
	TypeAdd
	TypeSubtract
	TypeMultiply
	TypeDivide
	TypeModulus
	TypeExponentiation
	TypeDiceUnary
	TypeDice
	TypeDicePenalty
	TypeDiceBonus
	TypeDiceFate
	TypeDiceWod
	TypeWodSetInit       // 重置参数
	TypeWodSetPool       // 设置骰池(骰数)
	TypeWodSetPoints     // 面数
	TypeWodSetThreshold  // 阈值 >=
	TypeWodSetThresholdQ // 阈值 <=
	TypeDiceDC
	TypeDCSetInit
	TypeDCSetPool   // 骰池
	TypeDCSetPoints // 面数
	TypeLoadVarname
	TypeLoadFormatString
	TypeStore
	TypeHalt
	TypeSwap
	TypeLeftValueMark
	TypeDiceSetK
	TypeDiceSetQ
	TypeClearDetail

	TypePop

	TypeCompLT
	TypeCompLE
	TypeCompEQ
	TypeCompNE
	TypeCompGE
	TypeCompGT

	TypeJmp
	TypeJe
	TypeJne

	TypeBitwiseAnd
	TypeBitwiseOr
	TypeLogicAnd
	TypeLogicOr

	TypeStSetName
	TypeStModify
	TypeNop

	TypeLoadVarnameForThis
	TypeConvertInt
	TypeConvertStr
)

type VMDndComputedValueData

type VMDndComputedValueData struct {
	BaseValue VMValue `json:"base_value"`
	Expr      string  `json:"expr"`
}

func (*VMDndComputedValueData) ReadBaseInt64

func (vd *VMDndComputedValueData) ReadBaseInt64() (int64, bool)

func (*VMDndComputedValueData) SetValue

func (vd *VMDndComputedValueData) SetValue(v *VMValue)

type VMResult

type VMResult struct {
	VMValue
	Parser  *DiceRollParser
	Matched string
	// contains filtered or unexported fields
}

type VMStack

type VMStack = VMValue

type VMValue

type VMValue struct {
	TypeID      VMValueType `json:"typeId"`
	Value       interface{} `json:"value"`
	ExpiredTime int64       `json:"expiredTime"`
}

func DiceDCRollVM

func DiceDCRollVM(e *RollExpression, addLine *VMValue, pool *VMValue, points *VMValue) (*VMValue, int64, int64, []string)

func DiceWodRollVM

func DiceWodRollVM(e *RollExpression, addLine *VMStack, pool *VMValue, points *VMValue, threshold *VMValue, isGE bool) (*VMValue, int64, int64, []string)

func VMValueConvert

func VMValueConvert(val *VMValue, v *map[string]*VMValue, key string) *VMValue

func VMValueNew

func VMValueNew(typeID VMValueType, val interface{}) *VMValue

func VMValueNewComputed

func VMValueNewComputed(expr string) *VMValue

func VMValueNewComputedRaw

func VMValueNewComputedRaw(computed *ComputedData) *VMValue

func VarGetValue

func VarGetValue(ctx *MsgContext, s string) (*VMValue, bool)

func (*VMValue) AsBool

func (v *VMValue) AsBool() bool

func (*VMValue) ComputedExecute

func (v *VMValue) ComputedExecute(ctx *MsgContext, curDepth int64) (*VMResult, string, error)

func (*VMValue) ConvertToDiceScriptValue

func (v *VMValue) ConvertToDiceScriptValue() *ds.VMValue

func (*VMValue) ReadComputed

func (v *VMValue) ReadComputed() (*ComputedData, bool)

func (*VMValue) ReadInt64

func (v *VMValue) ReadInt64() (int64, bool)

func (*VMValue) ReadString

func (v *VMValue) ReadString() (string, bool)

func (*VMValue) ToString

func (v *VMValue) ToString() string

type VMValueType

type VMValueType int
const (
	VMTypeInt64            VMValueType = 0
	VMTypeString           VMValueType = 1
	VMTypeBool             VMValueType = 2
	VMTypeExpression       VMValueType = 3
	VMTypeNone             VMValueType = 4
	VMTypeDNDComputedValue VMValueType = 5  // 旧computed
	VMTypeComputedValue    VMValueType = 15 // 新computed
)

type VersionInfo

type VersionInfo struct {
	VersionLatest           string `yaml:"versionLatest" json:"versionLatest"`
	VersionLatestDetail     string `yaml:"versionLatestDetail" json:"versionLatestDetail"`
	VersionLatestCode       int64  `yaml:"versionLatestCode" json:"versionLatestCode"`
	VersionLatestNote       string `yaml:"versionLatestNote" json:"versionLatestNote"`
	MinUpdateSupportVersion int64  `yaml:"minUpdateSupportVersion" json:"minUpdateSupportVersion"`
	NewVersionURLPrefix     string `yaml:"newVersionUrlPrefix" json:"newVersionUrlPrefix"`
	UpdaterURLPrefix        string `yaml:"updaterUrlPrefix" json:"updaterUrlPrefix"`
}

type WalleQConfig

type WalleQConfig struct {
	// wq 支持复数的 qq 登录 // 多进程 or 单进程 ?
	QQ map[string]WqQQ `toml:"qq"`
	// 元数据
	Meta WqMeta `toml:"meta"`
	// 连接方式必须完整,哪怕没有用到 http 连接方式
	Onebot struct {
		HTTP         []interface{} `toml:"http"`
		HTTPWebhook  []interface{} `toml:"http_webhook"`
		WebsocketRev []interface{} `toml:"websocket_rev"`
		Websocket    []WqWS        `toml:"websocket"`
		// 心跳
		Heartbeat struct {
			Enabled  bool `toml:"enabled"`
			Interval int  `toml:"interval"`
		} `toml:"heartbeat"`
	} `toml:"onebot"`
}

type WqMeta

type WqMeta struct {
	LogLevel       string `toml:"log_level"`
	EventCacheSize int    `toml:"event_cache_size"`
	Sled           bool   `toml:"sled"`
	Leveldb        bool   `toml:"leveldb"`
}

type WqQQ

type WqQQ struct {
	Password string `toml:"password,omitempty"`
	Protocol int    `toml:"protocol"`
}

type WqWS

type WqWS struct {
	Host string `toml:"host"`
	Port int    `toml:"port"`
}

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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