Documentation
¶
Index ¶
- Constants
- type CustomElement
- type GroupTarget
- type IMsgCtx
- type ImageBytesElement
- type MSG
- func (m *MSG) Append(elems ...message.IMessageElement) *MSG
- func (m *MSG) Elements() []message.IMessageElement
- func (m *MSG) Image(buf []byte, alternative string) *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) ImageWithNorm(buf []byte, alternative string) *MSG
- func (m *MSG) Text(s string) *MSG
- func (m *MSG) Textf(format string, args ...interface{}) *MSG
- 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 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomElement ¶
type CustomElement interface {
PackToElement(target Target) message.IMessageElement
}
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 NewImageByUrl ¶
func NewImageByUrl(url string, opts ...requests.Option) *ImageBytesElement
func NewImageByUrlWithNorm ¶ added in v1.0.1
func NewImageByUrlWithNorm(url string, opts ...requests.Option) *ImageBytesElement
func NewImageWithNorm ¶ added in v1.0.1
func NewImageWithNorm(buf []byte) *ImageBytesElement
func (*ImageBytesElement) Alternative ¶
func (i *ImageBytesElement) Alternative(s string) *ImageBytesElement
func (*ImageBytesElement) PackToElement ¶
func (i *ImageBytesElement) PackToElement(target Target) message.IMessageElement
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) ImageByUrl ¶
func (*MSG) ImageByUrlWithNorm ¶ added in v1.0.1
func (*MSG) ImageWithNorm ¶ added in v1.0.1
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.