B
B
boda10062021-12-28 10:22:36
Python
boda1006, 2021-12-28 10:22:36

Error in creating a VKontakte referral system?

Hello, I found on the Internet the implementation of the ref system on the vk_api library but I get an error. I understand that the event does not have a ref attribute, but I would like to know how then to get a ref from such a link 'vk.me/{grup_name)?ref=13&ref_source=13' ?

CODE:

from vk_api.longpoll import VkLongPoll, VkEventType
import requests
import vk_api
from config import Tokens
tokens = Tokens()
token = tokens.vk
vk_session = vk_api.VkApi(token=token)

longpoll = VkLongPoll(vk_session)
vk = vk_session.get_api( )

for event in longpoll.listen():
if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.text:



print(event.ref)

ERROR:

AttributeError: 'Event' object has no attribute 'ref'

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question