def from_api(token, params): chat = Vk.api('messages.getChat', token, params) if chat == None: return Vk_chat() vk_chat = Vk_chat(**chat) vk_chat.persist() return vk_chat
def from_api(token, params): users = Vk.api('users.get', token, params) if users == None: return Vk_user() if len(users) == 0: return Vk_user() user = Vk_user(**users[0]) user.persist() return user
def send_message(self, token, message): params = {'chat_id': self.id, 'message':message} message_id = Vk.api('messages.send', token, params)
def send_message(self, token, message): params = {'user_id': self.uid, 'message': message} message_id = Vk.api('messages.send', token, params)