@lp_clearfor.question_handler()
def question(event_h):
qid = event_h["question"]["id"]
text = event_h['question']['text']
a_text_1 = event_h['question']['answers'][0]['text']
a_text_2 = event_h['question']['answers'][1]['text']
a_text_3 = event_h['question']['answers'][2]['text']
number_q = event_h['question']['number']
clever_api_bota.comment(owner_id=video_owner_id, video_id=video_id, message='Появился новый вопрос. Удачи!')
api.messages.send(access_token=token_group, chat_id=2, message='Новый вопрос №' +str(number_q)+ '. 🌝 \n ' +str(text)+ ' \n Варианты ответа: \n 1⃣ ' +str(a_text_1)+ ' \n 2⃣ ' +str(a_text_2)+ ' \n 3⃣ ' +str(a_text_3)+ ' \n Желаю ответить верно!')
@lp_clearfor.friend_answer_handler()
def friend_answer(event_f):
ans = event_f['answer_id']
if ans == 0:
r_a = 1
if ans == 1:
r_a = 2
if ans == 2:
r_a = 3
clever_api_bota.comment(owner_id=video_owner_id, video_id=video_id, message='Ответ админа: ' + str(r_a))
api.messages.send(access_token = token_group, chat_id=2, message='❗ ❗ Админ дал ответ: ' + str(r_a))
@lp_clearfor.right_answer_handler()
def question_answers_right(event):
api.messages.send(access_token=token_group, chat_id=1, message='New data: '+str(event))
text = event['question']['text']
text_1 = event['question']['answers'][0]['text']
text_2 = event['question']['answers'][1]['text']
text_3 = event['question']['answers'][2]['text']
right = event['question']['right_answer_id']
if right == 0:
id_q = event['question']['answers'][0]['id']
if right == 1:
id_q = event['question']['answers'][1]['id']
if right == 2:
id_q = event['question']['answers'][2]['id']
if id_q == 0:
right_q = 1
v_a = text_1
ua = id_q = event['question']['answers'][0]['users_answered']
if id_q == 1:
right_q = 2
v_a = text_2
ua = id_q = event['question']['answers'][1]['users_answered']
if id_q == 2:
right_q = 3
v_a = text_3
ua = id_q = event['question']['answers'][2]['users_answered']
rub = prize // ua
api.messages.send(access_token=token_group, chat_id=2, message= 'На вопрос: \n "'+str(text)+'" \n Верный вариант ответа был: '+str(v_a)+' ('+str(right_q)+' вариант ответа.) \n Верно ответило: '+str(ua)+' человек.')
api.messages.send(access_token=token_group, chat_id=2, message= 'На данный момент выигрыш составляет: '+str(rub)+' руб.')
clever_api_bota.comment(owner_id=video_owner_id, video_id=video_id, message='Сумма выигрыша на данный момент: '+str(rub)+'
Как осуществить?