Skip to content

Commit

Permalink
add item bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonp committed Oct 10, 2014
1 parent e3f2faa commit 90d4cc5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions botspade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def respond_to_commands(message)
item_description_and_price = newmessage.gsub(new_item + " ", "")
new_item_price = item_description_and_price.split(' ')[0]
item_description = item_description_and_price.gsub(new_item_price + " ", "")
msg channel, "success" if db_set_item(new_item, item_description, new_item_price, 0)
msg channel, "success" if db_set_item(new_item, item_description, new_item_price, 0, "true")
end
end

Expand Down Expand Up @@ -282,7 +282,7 @@ def respond_to_commands(message)
item_description_and_price = newmessage.gsub(new_item + " ", "")
new_item_price = item_description_and_price.split(' ')[0]
item_description = item_description_and_price.gsub(new_item_price + " ", "")
msg channel, "success" if db_set_item(new_item, item_description, new_item_price, 1)
msg channel, "success" if db_set_item(new_item, item_description, new_item_price, 1, "true")
end
end

Expand Down
4 changes: 2 additions & 2 deletions db_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def db_remove_command(command_id)
# Items
# item[0] = id, [1] = name, [2] = description, [3] = price, [4] = ownable, [5] = timestamp, [6] = live
#
def db_set_item(name, description, price, ownable)
return true if @db.execute( "INSERT INTO items ( name, description, price, ownable, timestamp, live ) VALUES ( ?, ?, ?, ?, ?, ? )", [name, description, price, ownable, Time.now.utc.to_i, true])
def db_set_item(name, description, price, ownable, live)
return true if @db.execute( "INSERT INTO items ( name, description, price, ownable, timestamp, live ) VALUES ( ?, ?, ?, ?, ?, ? )", [name, description, price, ownable, Time.now.utc.to_i, live])
end

def db_get_all_items
Expand Down

0 comments on commit 90d4cc5

Please sign in to comment.