Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*-coding:u8-*-
- from account import *
- from vklib import *
- vk = VKClient(delay_time=.5)
- vk.login(username, password)
- interactive_id=76134582
- lurkopub_id=26406986
- adminchat_id=1527 # cur.peer-2e9 /im?.*sel=<chat_id>
- last_suggest_post_id=int(vk.api('storage.get',key='last_lurkopab_suggest_post_id')) or 0
- while 1:
- posts=vk.api('wall.get',owner_id=-lurkopub_id,filter='suggests',count=20)['items']
- ids=[post['id'] for post in posts]
- # print ids
- ids.reverse()
- # print last_suggest_post_id
- for idr in ids:
- if last_suggest_post_id>=idr:
- continue
- poll_id=vk.api('polls.create',question=u'Как?',add_answers=u'["ГОДНОТА","ХУЕТА"]',owner_id=-interactive_id)['id']
- # если аттачей не было, то при редактировании их нельзя прикрепить, причем аттачи нельзя заменить!
- attach='poll-%s_%s' % (interactive_id, poll_id)
- post_id=vk.api('wall.post', owner_id=-interactive_id, attachments=attach)['post_id']
- mess=u'Оцениваем: http://vk.com/wall-%s_%s?w=wall-%s_%s\n' % (interactive_id, post_id, lurkopub_id, idr)
- mess+=u'Прямая ссылка: http://vk.com/wall-%s_%s (через нее можно опубликовать)' % (lurkopub_id, idr)
- vk.api('wall.edit', post_id=post_id, owner_id=-interactive_id, message=mess, attachments=attach)
- vk.api('messages.send', chat_id=adminchat_id, message=u'Голосуем.', attachment='wall-%s_%s'%(interactive_id,post_id))
- vk.api('storage.set',key='last_lurkopab_suggest_post_id',value=idr)
- last_suggest_post_id=idr
- vk.delay(300)
- vk.delay(60)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement