diff --git a/auth.go b/auth.go index f3910e24..92fa6edb 100644 --- a/auth.go +++ b/auth.go @@ -119,7 +119,7 @@ func (a *Auth) handleLogOnResponse(packet *Packet) { ExtendedResult: EResult(body.GetEresultExtended()), OutOfGameSecsPerHeartbeat: body.GetOutOfGameHeartbeatSeconds(), InGameSecsPerHeartbeat: body.GetInGameHeartbeatSeconds(), - PublicIp: body.GetPublicIp(), + PublicIp: body.GetDeprecatedPublicIp(), ServerTime: body.GetRtime32ServerTime(), AccountFlags: EAccountFlags(body.GetAccountFlags()), ClientSteamId: SteamId(body.GetClientSuppliedSteamid()), @@ -127,7 +127,7 @@ func (a *Auth) handleLogOnResponse(packet *Packet) { CellId: body.GetCellId(), CellIdPingThreshold: body.GetCellIdPingThreshold(), Steam2Ticket: body.GetSteam2Ticket(), - UsePics: body.GetUsePics(), + UsePics: body.GetDeprecatedUsePics(), WebApiUserNonce: body.GetWebapiAuthenticateUserNonce(), IpCountryCode: body.GetIpCountryCode(), VanityUrl: body.GetVanityUrl(), diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..a16ac0b9 --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module github.com/Philipp15b/go-steam + +go 1.14 + +require ( + github.com/davecgh/go-spew v1.1.1 + github.com/golang/protobuf v1.4.2 +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..8b26de54 --- /dev/null +++ b/go.sum @@ -0,0 +1,22 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= diff --git a/gsbot/gsbot/gsbot.go b/gsbot/gsbot/gsbot.go index 069dca50..b32b2bef 100644 --- a/gsbot/gsbot/gsbot.go +++ b/gsbot/gsbot/gsbot.go @@ -29,9 +29,9 @@ func main() { bot := gsbot.Default() client := bot.Client auth := gsbot.NewAuth(bot, &gsbot.LogOnDetails{ - os.Args[1], - os.Args[2], - authcode, + Username: os.Args[1], + Password: os.Args[2], + AuthCode: authcode, }, "sentry.bin") debug, err := gsbot.NewDebug(bot, "debug") if err != nil { diff --git a/social.go b/social.go index 3e47e089..a03ec9e2 100644 --- a/social.go +++ b/social.go @@ -84,14 +84,14 @@ func (s *Social) SetPersonaState(state EPersonaState) { // Sends a chat message to ether a room or friend func (s *Social) SendMessage(to SteamId, entryType EChatEntryType, message string) { - //Friend + // Friend if to.GetAccountType() == int32(EAccountType_Individual) || to.GetAccountType() == int32(EAccountType_ConsoleUser) { s.client.Write(NewClientMsgProtobuf(EMsg_ClientFriendMsg, &CMsgClientFriendMsg{ Steamid: proto.Uint64(to.ToUint64()), ChatEntryType: proto.Int32(int32(entryType)), Message: []byte(message), })) - //Chat room + // Chat room } else if to.GetAccountType() == int32(EAccountType_Clan) || to.GetAccountType() == int32(EAccountType_Chat) { chatId := to.ClanToChat() s.client.Write(NewClientMsg(&MsgClientChatMsg{ @@ -119,9 +119,9 @@ func (s *Social) RemoveFriend(id SteamId) { // Ignores or unignores a friend on Steam func (s *Social) IgnoreFriend(id SteamId, setIgnore bool) { - ignore := uint8(1) //True + ignore := uint8(1) // True if !setIgnore { - ignore = uint8(0) //False + ignore = uint8(0) // False } s.client.Write(NewClientMsg(&MsgClientSetIgnoreFriend{ MySteamId: s.client.SteamId(), @@ -244,7 +244,7 @@ func (s *Social) HandlePacket(packet *Packet) { } func (s *Social) handleAccountInfo(packet *Packet) { - //Just fire the personainfo, Auth handles the callback + // Just fire the personainfo, Auth handles the callback flags := EClientPersonaStateFlag_PlayerName | EClientPersonaStateFlag_Presence | EClientPersonaStateFlag_SourceID s.RequestFriendInfo(s.client.SteamId(), EClientPersonaStateFlag(flags)) } @@ -302,7 +302,7 @@ func (s *Social) handlePersonaState(packet *Packet) { flags := EClientPersonaStateFlag(list.GetStatusFlags()) for _, friend := range list.GetFriends() { id := SteamId(friend.GetFriendid()) - if id == s.client.SteamId() { //this is our client id + if id == s.client.SteamId() { // this is our client id s.mutex.Lock() if friend.GetPlayerName() != "" { s.name = friend.GetPlayerName() @@ -364,7 +364,6 @@ func (s *Social) handlePersonaState(packet *Packet) { ClanRank: friend.GetClanRank(), ClanTag: friend.GetClanTag(), OnlineSessionInstances: friend.GetOnlineSessionInstances(), - PublishedSessionId: friend.GetPublishedInstanceId(), PersonaSetByUser: friend.GetPersonaSetByUser(), }) } @@ -407,7 +406,7 @@ func (s *Social) handleClanState(packet *Packet) { }) } - //Add stuff to group + // Add stuff to group clanid := SteamId(body.GetSteamidClan()) if body.NameInfo != nil { info := body.NameInfo @@ -473,14 +472,14 @@ func (s *Social) handleChatEnter(packet *Packet) { payload := packet.ReadClientMsg(body).Payload reader := bytes.NewBuffer(payload) name, _ := ReadString(reader) - ReadByte(reader) //0 + ReadByte(reader) // 0 count := body.NumMembers chatId := SteamId(body.SteamIdChat) clanId := SteamId(body.SteamIdClan) s.Chats.Add(socialcache.Chat{SteamId: chatId, GroupId: clanId}) for i := 0; i < int(count); i++ { id, chatPerm, clanPerm := readChatMember(reader) - ReadBytes(reader, 6) //No idea what this is + ReadBytes(reader, 6) // No idea what this is s.Chats.AddChatMember(chatId, socialcache.ChatMember{ SteamId: SteamId(id), ChatPermissions: chatPerm, @@ -508,7 +507,7 @@ func (s *Social) handleChatMemberInfo(packet *Packet) { actedOn, _ := ReadUint64(reader) state, _ := ReadInt32(reader) actedBy, _ := ReadUint64(reader) - ReadByte(reader) //0 + ReadByte(reader) // 0 stateChange := EChatMemberStateChange(state) if stateChange == EChatMemberStateChange_Entered { _, chatPerm, clanPerm := readChatMember(reader) @@ -537,13 +536,13 @@ func (s *Social) handleChatMemberInfo(packet *Packet) { func readChatMember(r io.Reader) (SteamId, EChatPermission, EClanPermission) { ReadString(r) // MessageObject ReadByte(r) // 7 - ReadString(r) //steamid + ReadString(r) // steamid id, _ := ReadUint64(r) ReadByte(r) // 2 - ReadString(r) //Permissions + ReadString(r) // Permissions chat, _ := ReadInt32(r) ReadByte(r) // 2 - ReadString(r) //Details + ReadString(r) // Details clan, _ := ReadInt32(r) return SteamId(id), EChatPermission(chat), EClanPermission(clan) } diff --git a/social_events.go b/social_events.go index b495131d..f386b3ca 100644 --- a/social_events.go +++ b/social_events.go @@ -48,7 +48,6 @@ type PersonaStateEvent struct { ClanRank uint32 ClanTag string OnlineSessionInstances uint32 - PublishedSessionId uint32 PersonaSetByUser bool }