Added hasitem
This commit is contained in:
parent
4af0009323
commit
42727cbe48
16
item.go
16
item.go
@ -23,6 +23,22 @@ type Item struct {
|
||||
Owned bool
|
||||
}
|
||||
|
||||
// HasItem will return if you own the item
|
||||
func (s *Session) HasItem(id int) (bool, error) {
|
||||
resp, err := s.client.Get(fmt.Sprintf("http://api.roblox.com/Ownership/HasAsset?userId=%d&assetId=%d", s.ID, id))
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
data, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return string(data) == "true", nil
|
||||
}
|
||||
|
||||
// AddItem add item by id to inventory
|
||||
func (s *Session) AddItem(id int, seller int) error {
|
||||
v := url.Values{}
|
||||
|
Loading…
Reference in New Issue
Block a user