Documentation
¶
Index ¶
- Constants
- 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) Clone() *MSG
- func (m *MSG) Cut()
- 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) 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 PrivateTarget
- type Target
- type TargetType
- type TypedElement
Constants ¶
View Source
const ( ImageBytes message.ElementType = 10000 + iota Typed Cut )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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
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 (*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 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.