Untitled

mail@pastecode.io avatar
unknown
python
2 months ago
994 B
1
Indexable
Never
# зависимости
import vk_api, traceback, random, time
from config import my_token

# бот
user = vk_api.VkApi(token=my_token)


# *** УТИЛИТЫ ***

# функция развёртки стека
def expand_stack(e):
	tb_str = traceback.format_exception(type(e), e, e.__traceback__)
	print("Exception! \n " + "".join(tb_str))

# функция получения списка постов со стены группы
def report(group_id):
	buffer = []
	try:
		buffer = user.method("wall.get", {
			"owner_id": group_id * -1,
			"count": 60,
			"offset": 0,
		})
		for post in buffer["items"]:
			try:
				check = user.method("wall.reportPost", {
					"owner_id": group_id * -1,
					"post_id": post["id"],
					"reason": 6
                })
				print(check)
				time.sleep(random.randint(10, 20))
            except Exception as e: expand_stack(e)
	except Exception as e: expand_stack(e)

# погнали ёбнврот
report(119691210)
Leave a Comment