Error occurring when sending an offer
Closed this issue · 3 comments
def send_offer
account = Handler.new('********','********','shared_secret')
me = account.normal_get_inventory('***************', 570)
his = account.normal_get_inventory("Skanby")
myarray = [me[5] , me[20] , me[60]].compact!
theirarray = [his[1], his[20], his[30]].compact!
# whenever
account.send_offer(myarray,theirarray,"******************************************", "send offer!")
end
When sending an offer the following error is occurring, what could it be?
There are few possibilities that come to mind for this issue:
Are you sure the trade link you are using is valid ?
can you inspect his[1]
and make sure it is not gems, this library was not made with gems in mind.
actually his [1] was coming from gems, I made other changes in relation to the code above where myarray put an item where it is exchangeable and now it is giving a different error, which I am not able to understand it.
def send offer
account = Handler.new('*******','**********')
me = account.normal_get_inventory('*************', 570)
his = account.normal_get_inventory("76561199093280846", 570)
myarray = [me[7]].compact!
theirarray = [].compact!
# whenever
trade_url = "https://steamcommunity.com/tradeoffer/new/?partner=1133015118&token=gL6cA2A6"
account.send_offer(myarray, theirarray, trade_url)
end
that error is occurring due to [].compact!
here is the docs
if .compact!
does not make any changes to an array it will return nil
.
Since []
is already an empty array .compact!
will not do any modification and return nil
steam-trade will raise an error if it does not recieve an Array or a Hash as a trade argument.
also please make sure your me[7]
actually includes an item, otherwise you will encounter an error since you cannot send empty trade offers