C
C
chainikk2018-07-03 11:18:47
Python
chainikk, 2018-07-03 11:18:47

Bot in vk \ appeal to vk.api. How to do?

I'm making a bot for a school conversation. Something like this happens, but I want him to be able to kick through the team. As far as I know, this can only be done with a direct call to vk_api, via http, but I don’t understand how to proceed. Because the code in print is huge.5b3b31563ea4c857039870.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Mikhailov, 2018-07-04
@chainikk

Install vk_api (pip install vk_api) and make a request

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import vk_api

def main():

    login, password = 'LOGIN', 'PASSWORD'
    vk_session = vk_api.VkApi(login, password)
    try:
        vk_session.auth()
    except vk_api.AuthError as error_msg:
        print(error_msg)
        return

    vk = vk_session.get_api()
    response = vk.messages.removeChatUser(chat_id=ID_CHAT, user_id=ID_USER)

V
Vitaly, 2018-07-03
@vt4a2h

It's not that kind of code. Throw in Google translator or translate yourself what is written in error_msg.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question