Documentation
¶
Index ¶
- Constants
- type AtElement
- type CustomElement
- type CutElement
- type GroupTarget
- type IMsgCtx
- type ImageBytesElement
- func (i *ImageBytesElement) Alternative(s string) *ImageBytesElement
- func (i *ImageBytesElement) Norm() *ImageBytesElement
- func (i *ImageBytesElement) PackToElement(target Target) message.IMessageElement
- func (i *ImageBytesElement) Resize(width, height uint) *ImageBytesElement
- func (i *ImageBytesElement) Type() message.ElementType
- type MSG
- func (m *MSG) Append(elems ...message.IMessageElement) *MSG
- func (m *MSG) At(target int64) *MSG
- func (m *MSG) AtAll(prepend ...bool) *MSG
- func (m *MSG) Clear() *MSG
- func (m *MSG) Clone() *MSG
- func (m *MSG) Cut() *MSG
- func (m *MSG) Drop(predicate func(e message.IMessageElement, index int) bool) *MSG
- func (m *MSG) Elements() []message.IMessageElement
- func (m *MSG) Image(buf []byte, alternative string) *MSG
- func (m *MSG) ImageByLocal(filepath, alternative string) *MSG
- func (m *MSG) ImageByLocalWithNorm(filepath, alternative string) *MSG
- func (m *MSG) ImageByLocalWithResize(filepath, alternative string, width, height uint) *MSG
- func (m *MSG) ImageByUrl(url string, alternative string, opts ...requests.Option) *MSG
- func (m *MSG) ImageByUrlWithNorm(url string, alternative string, opts ...requests.Option) *MSG
- func (m *MSG) ImageByUrlWithResize(url string, alternative string, width, height uint, opts ...requests.Option) *MSG
- func (m *MSG) ImageWithNorm(buf []byte, alternative string) *MSG
- func (m *MSG) ImageWithResize(buf []byte, alternative string, width, height uint) *MSG
- func (m *MSG) Poke(target int64) *MSG
- func (m *MSG) Text(s string) *MSG
- func (m *MSG) Textf(format string, args ...interface{}) *MSG
- func (m *MSG) ToCombineMessage(target Target) *message.SendingMessage
- func (m *MSG) ToMessage(target Target) []*message.SendingMessage
- type PokeElement
- type PrivateTarget
- type Target
- type TargetType
- type TypedElement
Constants ¶
View Source
const ( ImageBytes message.ElementType = 10000 + iota Typed Cut At Poke )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtElement ¶ added in v1.0.7
func (*AtElement) PackToElement ¶ added in v1.0.7
func (a *AtElement) PackToElement(target Target) message.IMessageElement
func (*AtElement) Type ¶ added in v1.0.7
func (a *AtElement) Type() message.ElementType
type CustomElement ¶
type CustomElement interface {
PackToElement(target Target) message.IMessageElement
}
type CutElement ¶ added in v1.0.5
type CutElement struct { }
func (*CutElement) PackToElement ¶ added in v1.0.5
func (c *CutElement) PackToElement(Target) message.IMessageElement
func (*CutElement) Type ¶ added in v1.0.5
func (c *CutElement) Type() message.ElementType
type GroupTarget ¶
type GroupTarget struct {
GroupCode int64 `json:"group_code"`
}
func NewGroupTarget ¶
func NewGroupTarget(groupCode int64) *GroupTarget
func (*GroupTarget) TargetCode ¶
func (t *GroupTarget) TargetCode() int64
func (*GroupTarget) TargetType ¶
func (t *GroupTarget) TargetType() TargetType
type ImageBytesElement ¶
type ImageBytesElement struct { Buf []byte // contains filtered or unexported fields }
func NewImage ¶
func NewImage(buf []byte) *ImageBytesElement
func NewImageByLocal ¶ added in v1.0.5
func NewImageByLocal(filepath string) *ImageBytesElement
func NewImageByUrl ¶
func NewImageByUrl(url string, opts ...requests.Option) *ImageBytesElement
NewImageByUrl 默认会对相同的url使用缓存
func NewImageByUrlWithoutCache ¶ added in v1.0.7
func NewImageByUrlWithoutCache(url string, opts ...requests.Option) *ImageBytesElement
NewImageByUrlWithoutCache 默认情况下相同的url会存在缓存, 如果url会随机返回不同的图片,则需要禁用缓存 这个函数就是不使用缓存的版本
func (*ImageBytesElement) Alternative ¶
func (i *ImageBytesElement) Alternative(s string) *ImageBytesElement
func (*ImageBytesElement) Norm ¶ added in v1.0.6
func (i *ImageBytesElement) Norm() *ImageBytesElement
func (*ImageBytesElement) PackToElement ¶
func (i *ImageBytesElement) PackToElement(target Target) message.IMessageElement
func (*ImageBytesElement) Resize ¶ added in v1.0.6
func (i *ImageBytesElement) Resize(width, height uint) *ImageBytesElement
func (*ImageBytesElement) Type ¶
func (i *ImageBytesElement) Type() message.ElementType
type MSG ¶
type MSG struct {
// contains filtered or unexported fields
}
MSG 线程不安全
func NewMSGFromGroupMessage ¶ added in v1.0.9
func NewMSGFromGroupMessage(gm *message.GroupMessage) *MSG
func NewMSGFromPrivateMessage ¶ added in v1.0.9
func NewMSGFromPrivateMessage(pm *message.PrivateMessage) *MSG
func (*MSG) Elements ¶
func (m *MSG) Elements() []message.IMessageElement
func (*MSG) ImageByLocal ¶ added in v1.0.6
func (*MSG) ImageByLocalWithNorm ¶ added in v1.0.6
func (*MSG) ImageByLocalWithResize ¶ added in v1.0.6
func (*MSG) ImageByUrl ¶
func (*MSG) ImageByUrlWithNorm ¶ added in v1.0.1
func (*MSG) ImageByUrlWithResize ¶ added in v1.0.6
func (*MSG) ImageWithNorm ¶ added in v1.0.1
func (*MSG) ImageWithResize ¶ added in v1.0.6
func (*MSG) ToCombineMessage ¶ added in v1.0.5
func (m *MSG) ToCombineMessage(target Target) *message.SendingMessage
ToCombineMessage 总是返回 non-nil
type PokeElement ¶ added in v1.0.9
type PokeElement struct {
Uin int64
}
PokeElement 戳一戳
func NewPoke ¶ added in v1.0.9
func NewPoke(uin int64) *PokeElement
func (*PokeElement) PackToElement ¶ added in v1.0.9
func (p *PokeElement) PackToElement(target Target) message.IMessageElement
func (*PokeElement) Type ¶ added in v1.0.9
func (p *PokeElement) Type() message.ElementType
type PrivateTarget ¶
type PrivateTarget struct {
Uin int64 `json:"uin"`
}
func NewPrivateTarget ¶
func NewPrivateTarget(uin int64) *PrivateTarget
func (*PrivateTarget) TargetCode ¶
func (t *PrivateTarget) TargetCode() int64
func (*PrivateTarget) TargetType ¶
func (t *PrivateTarget) TargetType() TargetType
type Target ¶
type Target interface { TargetType() TargetType TargetCode() int64 }
type TargetType ¶
type TargetType int32
const ( TargetGroup TargetType = iota TargetPrivate )
func (TargetType) IsGroup ¶
func (t TargetType) IsGroup() bool
func (TargetType) IsPrivate ¶
func (t TargetType) IsPrivate() bool
type TypedElement ¶
type TypedElement struct {
// contains filtered or unexported fields
}
TypedElement 根据TargetType选择不同的element,不解决循环问题,使用不当可能导致堆栈溢出 可以同时设置 OnGroup 和 OnPrivate ,发送时会根据目标自动选择 如果只设置了一个,发送另一个时会返回 nil ,即这里什么也不发送
func NewGroupElement ¶
func NewGroupElement(e message.IMessageElement) *TypedElement
func NewPrivateElement ¶
func NewPrivateElement(e message.IMessageElement) *TypedElement
func NewTypedElement ¶
func NewTypedElement() *TypedElement
func (*TypedElement) OnGroup ¶
func (t *TypedElement) OnGroup(e message.IMessageElement) *TypedElement
func (*TypedElement) OnPrivate ¶
func (t *TypedElement) OnPrivate(e message.IMessageElement) *TypedElement
func (*TypedElement) PackToElement ¶
func (t *TypedElement) PackToElement(target Target) message.IMessageElement
func (*TypedElement) Type ¶
func (t *TypedElement) Type() message.ElementType
Click to show internal directories.
Click to hide internal directories.