def averagerevenue(bot, update): ws = gs.initWorksheet(google_api_json, sheetname) averagerev = gs.averageRevenue(ws) bot.send_message(chat_id=update.message.chat_id, text="Average revenue per week is <b>" + str(averagerev) + " CHF</b>", parse_mode='HTML')
def averageprice(bot, update): ws = gs.initWorksheet(google_api_json, sheetname) avgprice = gs.averagePrice(ws) bot.send_message(chat_id=update.message.chat_id, text="Average price paid for a license plate is <b>" + str(avgprice) + " CHF</b>", parse_mode='HTML')
def totalrevenue(bot, update): ws = gs.initWorksheet(google_api_json, sheetname) totalrev = gs.totalRevenue(ws) bot.send_message(chat_id=update.message.chat_id, text="Total revenue since 2018-3-15 is <b>" + str(totalrev) + " CHF</b>", parse_mode='HTML')
def highestprice(bot, update): ws = gs.initWorksheet(google_api_json, sheetname) max_price_arr = gs.maxPrice(ws) bot.send_message(chat_id=update.message.chat_id, text="The highest price paid since 2018-3-15 was <b>" + max_price_arr[0] + " CHF</b> for license plate no <b>" + max_price_arr[1] + "</b> on " + max_price_arr[2], parse_mode='HTML')
def weeklyUpdate(bot, job): """ calls gs.scanNewEntries and returns the results as array of arrays of chat_id, plate_number, price. Then messages are sent to the guys """ ws = gs.initWorksheet(google_api_json, sheetname) query_arr = stva.readNumFile(filename) current_auctions_dict = gs.currentAuctions(ws, query_arr) matches_arr = stva.mainSearch(query_arr, current_auctions_dict) for result in matches_arr: response_message = "Your lucky number "+result[0]+" has been found being auctioned in "+result[1]+" at a current price of "+result[3]+" CHF" bot.send_message(chat_id = result[2], text=response_message)