user

package
v0.4.12 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 13 Imported by: 48

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessage

func NewMessage(id string, accessory _interface.IAccessory) _interface.IMessage

NewMessage ...

Types

type Contact

type Contact struct {
	_interface.IAccessory

	Id string
	// contains filtered or unexported fields
}

func NewContact

func NewContact(id string, accessory _interface.IAccessory) *Contact

NewContact ...

func (*Contact) Alias

func (c *Contact) Alias() string

Alias get alias

func (*Contact) Avatar

func (c *Contact) Avatar() *filebox.FileBox

Avatar get avatar picture file stream

func (*Contact) City

func (c *Contact) City() string

City Get the region 'city' from a contact

func (*Contact) Friend

func (c *Contact) Friend() bool

Friend true for friend of the bot, false for not friend of the bot

func (*Contact) Gender

func (c *Contact) Gender() schemas.ContactGender

Gender gender

func (*Contact) ID

func (c *Contact) ID() string

func (*Contact) IsReady

func (c *Contact) IsReady() bool

func (*Contact) Name

func (c *Contact) Name() string

func (*Contact) Province

func (c *Contact) Province() string

Province Get the region 'province' from a contact

func (*Contact) Ready

func (c *Contact) Ready(forceSync bool) (err error)

Ready is For FrameWork ONLY!

func (*Contact) Say

func (c *Contact) Say(something interface{}) (msg _interface.IMessage, err error)

Say something params {(string | Contact | FileBox | UrlLink | MiniProgram)}

func (*Contact) Self

func (c *Contact) Self() bool

Self Check if contact is self

func (*Contact) SetAlias

func (c *Contact) SetAlias(newAlias string)

SetAlias set alias

func (*Contact) Star

func (c *Contact) Star() bool

Star check if the contact is star contact

func (*Contact) String

func (c *Contact) String() string

func (*Contact) Sync

func (c *Contact) Sync() error

Sync force reload data for Contact, sync data from lowlevel API again.

func (*Contact) Type

func (c *Contact) Type() schemas.ContactType

Type contact type

func (*Contact) Weixin

func (c *Contact) Weixin() string

Weixin get the weixin number from a contact Sometimes cannot get weixin number due to weixin security mechanism, not recommend.

type ContactSelf

type ContactSelf struct {
	*Contact
}

func NewContactSelf

func NewContactSelf(id string, accessory _interface.IAccessory) *ContactSelf

NewContactSelf ...

func (*ContactSelf) QRCode

func (c *ContactSelf) QRCode() (string, error)

QRCode get bot qrcode

func (*ContactSelf) SetAvatar

func (c *ContactSelf) SetAvatar(box *filebox.FileBox) error

SetAvatar SET the avatar for a bot

func (*ContactSelf) SetName

func (c *ContactSelf) SetName(name string) error

SetName change bot name

func (*ContactSelf) Signature

func (c *ContactSelf) Signature(signature string) error

Signature change bot signature

type Friendship

type Friendship struct {
	_interface.IAccessory
	// contains filtered or unexported fields
}

func NewFriendship

func NewFriendship(id string, accessory _interface.IAccessory) *Friendship

NewFriendship ...

func (*Friendship) Accept

func (f *Friendship) Accept() error

Accept friend request

func (*Friendship) Contact

func (f *Friendship) Contact() _interface.IContact

Contact ...

func (*Friendship) Hello

func (f *Friendship) Hello() string

Hello get verify message from

func (*Friendship) IsReady

func (f *Friendship) IsReady() bool

IsReady ...

func (*Friendship) Ready

func (f *Friendship) Ready() (err error)

Ready ...

func (*Friendship) String

func (f *Friendship) String() string

func (*Friendship) ToJSON

func (f *Friendship) ToJSON() (string, error)

toJSON get friendShipPayload Json

func (*Friendship) Type

func (f *Friendship) Type() schemas.FriendshipType

type Images

type Images struct {
	_interface.IAccessory
	ImageId string
}

func NewImages

func NewImages(id string, accessory _interface.IAccessory) *Images

NewImages create image struct

func (*Images) Artwork

func (img *Images) Artwork() (*filebox.FileBox, error)

Artwork message artwork images

func (*Images) HD

func (img *Images) HD() (*filebox.FileBox, error)

HD message hd images

func (*Images) Thumbnail

func (img *Images) Thumbnail() (*filebox.FileBox, error)

Thumbnail message thumbnail images

type Location added in v0.4.12

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

func NewLocation added in v0.4.12

func NewLocation(payload *schemas.LocationPayload) *Location

func (*Location) Accuracy added in v0.4.12

func (l *Location) Accuracy() float32

func (*Location) Address added in v0.4.12

func (l *Location) Address() string

func (*Location) Latitude added in v0.4.12

func (l *Location) Latitude() float64

func (*Location) Name added in v0.4.12

func (l *Location) Name() string

func (*Location) Payload added in v0.4.12

func (l *Location) Payload() schemas.LocationPayload

func (*Location) String added in v0.4.12

func (l *Location) String() string

type Message

type Message struct {
	_interface.IAccessory
	// contains filtered or unexported fields
}

func (*Message) Age

func (m *Message) Age() time.Duration

func (*Message) Date

func (m *Message) Date() time.Time

Date sent date

func (*Message) Forward

func (m *Message) Forward(contactOrRoomId string) error

Forward Forward the received message.

func (*Message) From

func (m *Message) From() _interface.IContact

From get the sender from a message Deprecated: please use Talker()

func (*Message) ID added in v0.1.2

func (m *Message) ID() string

ID message id

func (*Message) IsReady

func (m *Message) IsReady() bool

func (*Message) Listener added in v0.4.0

func (m *Message) Listener() _interface.IContact

Listener Get the destination of the message. listener() will return nil if a message is in a room use Room() to get the room.

func (*Message) MentionList

func (m *Message) MentionList() []_interface.IContact

MentionList get message mentioned contactList.

func (*Message) MentionSelf

func (m *Message) MentionSelf() bool

func (*Message) MentionText

func (m *Message) MentionText() string

func (*Message) Ready

func (m *Message) Ready() (err error)

func (*Message) Recall

func (m *Message) Recall() (bool, error)

Recall recall a message

func (*Message) Room

func (m *Message) Room() _interface.IRoom

Room get the room from the message.

func (*Message) Say

func (m *Message) Say(sayable interface{}) (_interface.IMessage, error)

Say reply a Text or Media File message to the sender. Support msg: string Contact filebox.FileBox UrlLink MiniProgram Location

func (*Message) Self

func (m *Message) Self() bool

Self check if a message is sent by self

func (*Message) String

func (m *Message) String() string

String() message to print string

func (*Message) Talker added in v0.4.0

func (m *Message) Talker() _interface.IContact

Talker Get the talker of a message.

func (*Message) Text

func (m *Message) Text() string

Text get the text content of the message

func (*Message) To

func (m *Message) To() _interface.IContact

To get the destination of the message Deprecated: please use Listener()

func (*Message) ToContact

func (m *Message) ToContact() (_interface.IContact, error)

ToContact Get Share Card of the Message Extract the Contact Card from the Message, and encapsulate it into Contact class

func (*Message) ToFileBox

func (m *Message) ToFileBox() (*filebox.FileBox, error)

ToFileBox extract the Media File from the Message, and put it into the FileBox.

func (*Message) ToImage

func (m *Message) ToImage() (_interface.IImage, error)

ToImage extract the Image File from the Message, so that we can use different image sizes.

func (*Message) ToLocation added in v0.4.12

func (m *Message) ToLocation() (*Location, error)

func (*Message) ToMiniProgram

func (m *Message) ToMiniProgram() (*MiniProgram, error)

func (*Message) ToRecalled

func (m *Message) ToRecalled() (_interface.IMessage, error)

ToRecalled get the recalled message

func (m *Message) ToUrlLink() (*UrlLink, error)

func (*Message) Type

func (m *Message) Type() schemas.MessageType

Type get the type from the message.

type MiniProgram

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

func NewMiniProgram

func NewMiniProgram(payload *schemas.MiniProgramPayload) *MiniProgram

func (*MiniProgram) AppID

func (mp *MiniProgram) AppID() string

func (*MiniProgram) Description

func (mp *MiniProgram) Description() string

func (*MiniProgram) IconUrl added in v0.4.0

func (mp *MiniProgram) IconUrl() string

func (*MiniProgram) PagePath

func (mp *MiniProgram) PagePath() string

func (*MiniProgram) Payload added in v0.4.0

func (mp *MiniProgram) Payload() schemas.MiniProgramPayload

func (*MiniProgram) ShareId added in v0.4.0

func (mp *MiniProgram) ShareId() string

func (*MiniProgram) ThumbKey

func (mp *MiniProgram) ThumbKey() string

func (*MiniProgram) ThumbUrl

func (mp *MiniProgram) ThumbUrl() string

func (*MiniProgram) Title

func (mp *MiniProgram) Title() string

func (*MiniProgram) Username

func (mp *MiniProgram) Username() string

type Room

type Room struct {
	_interface.IAccessory
	// contains filtered or unexported fields
}

func NewRoom

func NewRoom(id string, accessory _interface.IAccessory) *Room

NewRoom ...

func (*Room) Add

func (r *Room) Add(contact _interface.IContact) error

Add contact in a room

func (*Room) Alias

func (r *Room) Alias(contact _interface.IContact) (string, error)

Alias return contact's roomAlias in the room

func (*Room) Announce

func (r *Room) Announce() (string, error)

Announce get announce from the room

func (*Room) Avatar

func (r *Room) Avatar() (*filebox.FileBox, error)

Avatar get avatar from the room.

func (*Room) Del

func (r *Room) Del(contact _interface.IContact) error

Del delete a contact from the room it works only when the bot is the owner of the room

func (*Room) Has

func (r *Room) Has(contact _interface.IContact) (bool, error)

Has check if the room has member `contact`

func (*Room) ID

func (r *Room) ID() string

func (*Room) IsReady

func (r *Room) IsReady() bool

func (*Room) Member

func (r *Room) Member(query interface{}) (_interface.IContact, error)

Member Find all contacts in a room, if get many, return the first one. query params string or RoomMemberQueryFilter

func (*Room) MemberAll

func (r *Room) MemberAll(query interface{}) ([]_interface.IContact, error)

MemberAll all contacts in a room params nil or string or *schemas.RoomMemberQueryFilter

func (*Room) Owner

func (r *Room) Owner() _interface.IContact

Owner get room's owner from the room.

func (*Room) QrCode

func (r *Room) QrCode() (string, error)

QrCode Get QR Code Value of the Room from the room, which can be used as scan and join the room.

func (*Room) Quit

func (r *Room) Quit() error

Quit the room itself

func (*Room) Ready

func (r *Room) Ready(forceSync bool) (err error)

Ready is For FrameWork ONLY!

func (*Room) Say

func (r *Room) Say(something interface{}, mentionList ..._interface.IContact) (msg _interface.IMessage, err error)

Say something params {(string | Contact | FileBox | UrlLink | MiniProgram )} mentionList @ contact list

func (*Room) SetAnnounce

func (r *Room) SetAnnounce(text string) error

SetAnnounce set announce from the room It only works when bot is the owner of the room.

func (*Room) SetTopic

func (r *Room) SetTopic(topic string) error

SetTopic set topic from the room

func (*Room) String

func (r *Room) String() string

func (*Room) Sync

func (r *Room) Sync() error

Sync Force reload data for Room, Sync data from puppet API again.

func (*Room) Topic

func (r *Room) Topic() string

Topic get topic from the room

type RoomInvitation

type RoomInvitation struct {
	_interface.IAccessory
	// contains filtered or unexported fields
}

func NewRoomInvitation

func NewRoomInvitation(id string, accessory _interface.IAccessory) *RoomInvitation

NewRoomInvitation ...

func (*RoomInvitation) Accept

func (ri *RoomInvitation) Accept() error

Accept Room Invitation

func (*RoomInvitation) Age

func (ri *RoomInvitation) Age() (time.Duration, error)

Age returns the room invitation age in seconds

func (*RoomInvitation) Date

func (ri *RoomInvitation) Date() (time.Time, error)

Date get the invitation time

func (*RoomInvitation) Inviter

func (ri *RoomInvitation) Inviter() (_interface.IContact, error)

Inviter get the inviter from room invitation

func (*RoomInvitation) MemberCount

func (ri *RoomInvitation) MemberCount() (int, error)

func (*RoomInvitation) MemberList

func (ri *RoomInvitation) MemberList() ([]_interface.IContact, error)

MemberList list of Room Members that you known(is friend)

func (*RoomInvitation) String

func (ri *RoomInvitation) String() string

func (*RoomInvitation) ToJson

func (ri *RoomInvitation) ToJson() (string, error)

func (*RoomInvitation) ToStringAsync

func (ri *RoomInvitation) ToStringAsync() (string, error)

func (*RoomInvitation) Topic

func (ri *RoomInvitation) Topic() (string, error)

Topic get the room topic from room invitation

type Tag

type Tag struct {
	_interface.IAccessory
	// contains filtered or unexported fields
}

func NewTag

func NewTag(id string, accessory _interface.IAccessory) *Tag

NewTag ...

func (*Tag) Add

func (t *Tag) Add(to _interface.IContact) error

Add tag for contact

func (*Tag) ID

func (t *Tag) ID() string

func (*Tag) Remove

func (t *Tag) Remove(from _interface.IContact) error

Remove this tag from Contact

type UrlLink struct {
	// contains filtered or unexported fields
}
func NewUrlLink(payload *schemas.UrlLinkPayload) *UrlLink

func (*UrlLink) Description

func (ul *UrlLink) Description() string

func (*UrlLink) Payload added in v0.1.2

func (ul *UrlLink) Payload() schemas.UrlLinkPayload

Payload UrlLink payload

func (*UrlLink) String

func (ul *UrlLink) String() string

func (*UrlLink) ThumbnailUrl

func (ul *UrlLink) ThumbnailUrl() string

func (*UrlLink) Title

func (ul *UrlLink) Title() string

func (*UrlLink) Url

func (ul *UrlLink) Url() string

Jump to

Keyboard shortcuts

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