def refresh_price(update: Update, context: CallbackContext): print("refreshing price") message = general_end_functions.get_price(contract, pair_contract, graphql_client_eth, graphql_client_uni, name, decimals) update.callback_query.edit_message_text(text=message, parse_mode='html', reply_markup=reply_markup_price)
def get_price_token(update: Update, context: CallbackContext): message = general_end_functions.get_price(contract, pair_contract, graphql_client_eth, graphql_client_uni, name, decimals) chat_id = update.message.chat_id context.bot.send_message(chat_id=chat_id, text=message, parse_mode='html', reply_markup=reply_markup_price)
def get_price_token(update: Update, context: CallbackContext): message = general_end_functions.get_price(contract, pair_contract, graphql_client_eth, graphql_client_uni, name, decimals) chat_id = update.message.chat_id util.create_and_send_vote(name, "price", update.message.from_user.name, zerorpc_client_data_aggregator) context.bot.send_message(chat_id=chat_id, text=message, parse_mode='html', reply_markup=reply_markup_price, disable_web_page_preview=True)
def get_price_token(context: CallbackContext): for channel in get_my_channels(): if _should_send(channel): message = general_end_functions.get_price(channel.contract, channel.pair_contract, graphql_client_eth, graphql_client_uni, channel.ticker.upper(), decimals, uni_wrapper) context.bot.send_message(chat_id=channel.channel_id, text=message, parse_mode='html', disable_web_page_preview=True)
def refresh_price(update: Update, context: CallbackContext): print("refreshing price") query = update.callback_query.data contract_from_ticker = query.split('r_p_')[1].split('_t')[0] token_name = query.split('_t_')[1] message = general_end_functions.get_price(contract_from_ticker, "", graphql_client_eth, graphql_client_uni, token_name.upper(), 10**18) button_list_price = [[ InlineKeyboardButton('refresh', callback_data='refresh_price_' + contract_from_ticker) ]] reply_markup_price = InlineKeyboardMarkup(button_list_price) update.callback_query.edit_message_text(text=message, parse_mode='html', reply_markup=reply_markup_price, disable_web_page_preview=True)
def get_price_rot(update: Update, context: CallbackContext): chat_id = update.message.chat_id ticker = "ROT" contract_from_ticker = requests_util.get_token_contract_address(ticker) pprint.pprint(contract_from_ticker) button_list_price = [[ InlineKeyboardButton('refresh', callback_data='r_p_' + contract_from_ticker + "_t_" + ticker) ]] reply_markup_price = InlineKeyboardMarkup(button_list_price) message = general_end_functions.get_price(contract_from_ticker, "", graphql_client_eth, graphql_client_uni, ticker.upper(), 10**18) util.create_and_send_vote(ticker, "price", update.message.from_user.name, zerorpc_client_data_aggregator) context.bot.send_message(chat_id=chat_id, text=message, parse_mode='html', reply_markup=reply_markup_price, disable_web_page_preview=True)
def get_price_token(update: Update, context: CallbackContext): chat_id = update.message.chat_id query_received = update.message.text.split(' ') if len(query_received) == 2: ticker = query_received[1] contract_from_ticker = requests_util.get_token_contract_address(ticker) pprint.pprint(contract_from_ticker) if contract_from_ticker is None: context.bot.send_message(chat_id=chat_id, text='Contract address for ticker ' + ticker + ' not found.') else: util.create_and_send_vote(ticker, "price", update.message.from_user.name, zerorpc_client_data_aggregator) button_list_price = [[ InlineKeyboardButton('refresh', callback_data='r_p_' + contract_from_ticker + "_t_" + ticker) ]] reply_markup_price = InlineKeyboardMarkup(button_list_price) message = general_end_functions.get_price(contract_from_ticker, pair_contract, graphql_client_eth, graphql_client_uni, ticker.upper(), decimals) context.bot.send_message(chat_id=chat_id, text=message, parse_mode='html', reply_markup=reply_markup_price, disable_web_page_preview=True) elif len(query_received) == 1: # TODO: merge all those duplicate things ticker, addr = __get_default_token_channel(chat_id) if ticker is not None: if addr is None or addr == "": context.bot.send_message(chat_id=chat_id, text='Contract address for ticker ' + ticker + ' not found.') else: util.create_and_send_vote(ticker, "price", update.message.from_user.name, zerorpc_client_data_aggregator) button_list_price = [[ InlineKeyboardButton('refresh', callback_data='r_p_' + addr + "_t_" + ticker) ]] reply_markup_price = InlineKeyboardMarkup(button_list_price) message = general_end_functions.get_price( addr, pair_contract, graphql_client_eth, graphql_client_uni, ticker.upper(), decimals) context.bot.send_message(chat_id=chat_id, text=message, parse_mode='html', reply_markup=reply_markup_price, disable_web_page_preview=True) else: message = rejection_no_default_ticker_message context.bot.send_message(chat_id=chat_id, text=message, parse_mode='html') else: context.bot.send_message( chat_id=chat_id, text='Please specify the ticker of the desired token.')