def send(): chat_id = store.get_item('current_chat')['id'] chat_type = store.get_item('current_chat')['type'] if chat_id is None: return 'Error: chat has not selected' text = footer.message_line.get_edit_text() footer.message_line.clear() message = client.send_message(chat_id, text) chat.append_message(message, chat_type) body.history.scroll_end()
def print_start(call): client.send_message(call.from_user.id, BOT_START_MESSAGE)
def print_category(message): client.send_message(message.from_user.id, TEST_SELECT_CATEGORY, reply_markup=create_category_menu())
def print_info(call): client.send_message(call.from_user.id, BOT_INFO_MESSAGE)
def main(): with client: client.send_message(ANYA, get_random_message()) get_random_please_giph() client.send_file(ANYA, GIF_TMP_FILE) os.remove(GIF_TMP_FILE)
'--ip', default='localhost', help='Server IP you want to send the message to', type=str, ) parser.add_argument( '-p', '--port', default=5001, help='Server port you want to send the message to', type=int, ) if __name__ == '__main__': options = parser.parse_args() logger.from_argparse(logger, options) log = logger.get_logger(__name__) log.debug('options: %s', options) log.info('Sending Message: %s' % options.message) message_info = MessageInfo(options.id, options.ip, options.port, options.message) message = send_message(message_info) if message is None: sys.exit(1) log.info('sent message: %s', message.serialize(to_string=False))
def msg_line_on_enter(value): message = client.send_message(client.CHAT_WITH['username'], value) ui.msg_list.append_child(ui.Message(message, text=value)) return 0