-
Notifications
You must be signed in to change notification settings - Fork 132
/
social_events.go
160 lines (140 loc) · 4.54 KB
/
social_events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
package steam
import (
"time"
"github.com/Philipp15b/go-steam/v3/protocol/protobuf"
"github.com/Philipp15b/go-steam/v3/protocol/steamlang"
"github.com/Philipp15b/go-steam/v3/steamid"
)
type FriendsListEvent struct{}
type FriendStateEvent struct {
SteamId steamid.SteamId `json:",string"`
Relationship steamlang.EFriendRelationship
}
func (f *FriendStateEvent) IsFriend() bool {
return f.Relationship == steamlang.EFriendRelationship_Friend
}
type GroupStateEvent struct {
SteamId steamid.SteamId `json:",string"`
Relationship steamlang.EClanRelationship
}
func (g *GroupStateEvent) IsMember() bool {
return g.Relationship == steamlang.EClanRelationship_Member
}
// Fired when someone changing their friend details
type PersonaStateEvent struct {
StatusFlags steamlang.EClientPersonaStateFlag
FriendId steamid.SteamId `json:",string"`
State steamlang.EPersonaState
StateFlags steamlang.EPersonaStateFlag
GameAppId uint32
GameId uint64 `json:",string"`
GameName string
GameServerIp uint32
GameServerPort uint32
QueryPort uint32
SourceSteamId steamid.SteamId `json:",string"`
GameDataBlob []byte
Name string
Avatar []byte
LastLogOff uint32
LastLogOn uint32
ClanRank uint32
ClanTag string
OnlineSessionInstances uint32
PersonaSetByUser bool
RichPresence []*protobuf.CMsgClientPersonaState_Friend_KV
}
// Fired when a clan's state has been changed
type ClanStateEvent struct {
ClanId steamid.SteamId `json:",string"`
AccountFlags steamlang.EAccountFlags
ClanName string
Avatar []byte
MemberTotalCount uint32
MemberOnlineCount uint32
MemberChattingCount uint32
MemberInGameCount uint32
Events []ClanEventDetails
Announcements []ClanEventDetails
}
type ClanEventDetails struct {
Id uint64 `json:",string"`
EventTime uint32
Headline string
GameId uint64 `json:",string"`
JustPosted bool
}
// Fired in response to adding a friend to your friends list
type FriendAddedEvent struct {
Result steamlang.EResult
SteamId steamid.SteamId `json:",string"`
PersonaName string
}
// Fired when the client receives a message from either a friend or a chat room
type ChatMsgEvent struct {
ChatRoomId steamid.SteamId `json:",string"` // not set for friend messages
ChatterId steamid.SteamId `json:",string"`
Message string
EntryType steamlang.EChatEntryType
Timestamp time.Time
Offline bool
}
// Whether the type is ChatMsg
func (c *ChatMsgEvent) IsMessage() bool {
return c.EntryType == steamlang.EChatEntryType_ChatMsg
}
// Fired in response to joining a chat
type ChatEnterEvent struct {
ChatRoomId steamid.SteamId `json:",string"`
FriendId steamid.SteamId `json:",string"`
ChatRoomType steamlang.EChatRoomType
OwnerId steamid.SteamId `json:",string"`
ClanId steamid.SteamId `json:",string"`
ChatFlags byte
EnterResponse steamlang.EChatRoomEnterResponse
Name string
}
// Fired in response to a chat member's info being received
type ChatMemberInfoEvent struct {
ChatRoomId steamid.SteamId `json:",string"`
Type steamlang.EChatInfoType
StateChangeInfo StateChangeDetails
}
type StateChangeDetails struct {
ChatterActedOn steamid.SteamId `json:",string"`
StateChange steamlang.EChatMemberStateChange
ChatterActedBy steamid.SteamId `json:",string"`
}
// Fired when a chat action has completed
type ChatActionResultEvent struct {
ChatRoomId steamid.SteamId `json:",string"`
ChatterId steamid.SteamId `json:",string"`
Action steamlang.EChatAction
Result steamlang.EChatActionResult
}
// Fired when a chat invite is received
type ChatInviteEvent struct {
InvitedId steamid.SteamId `json:",string"`
ChatRoomId steamid.SteamId `json:",string"`
PatronId steamid.SteamId `json:",string"`
ChatRoomType steamlang.EChatRoomType
FriendChatId steamid.SteamId `json:",string"`
ChatRoomName string
GameId uint64 `json:",string"`
}
// Fired in response to ignoring a friend
type IgnoreFriendEvent struct {
Result steamlang.EResult
}
// Fired in response to requesting profile info for a user
type ProfileInfoEvent struct {
Result steamlang.EResult
SteamId steamid.SteamId `json:",string"`
TimeCreated uint32
RealName string
CityName string
StateName string
CountryName string
Headline string
Summary string
}