Пример #1
0
    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
Пример #2
0
    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
Пример #3
0
    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
Пример #4
0
 def send_message(self, token, message):
     params = {'chat_id': self.id, 'message':message}
     message_id = Vk.api('messages.send', token, params)
Пример #5
0
 def send_message(self, token, message):
     params = {'user_id': self.uid, 'message': message}
     message_id = Vk.api('messages.send', token, params)