from aiogram import Bot, Dispatcher, executor, types
import logging
import asyncio
import Config
import DiagramScript
import os
logging.basicConfig(level=logging.INFO)
bot = Bot(token=Config.ConfigData.TOKEN)
dp = Dispatcher(bot)
message = None
# Приветствие
@dp.message_handler(commands = ['start'])
async def Greeting(message: types.Message):
ChatId = message.chat.id
await bot.send_message(text = Config.ConfigData.Gereeting, chat_id = ChatId, reply_markup = Config.Keyboard.BuildGraphKeyboard)
# Кол-во строк
@dp.message_handler(content_types = ['text'])
async def Ask2OfGraph(message: types.Message):
ChatId = message.chat.id
await bot.send_message(text = Config.ConfigData.ASK2, chat_id = ChatId)
num1 = message.text
return int(num1)
# Отправка графика
@dp.message_handler(content_types = ['text'])
async def SendingGraph(message: types.Message):
if message.text == "Построить график":
ChatId = message.chat.id
diagram = open("Graph.png", "rb")
messageText = "Вот диаграмма"
await bot.send_photo(caption = messageText, chat_id = ChatId, photo = diagram)
if __name__ == "__main__":
DiagramScript.BuildGraph(Ask2OfGraph(message), 10)
executor.start_polling(dp)
import parser
from aiogram import Bot, Dispatcher, executor, types
import logging
from Config import TOKEN
import asyncio
VkId = None
logging.basicConfig(level=logging.INFO)
bot = Bot(token=TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(commands=['start'], content_types=["text"])
async def InputLinkVk(message: types.Message):
await message.reply("Введите ID пользователя во ВК")
message.text = VkId
@dp.message_handler(content_types=["text"])
async def ParsingVK(message: types.Message): # Доделать
await message.reply(div)
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
import vk_api
import Bot
import requests
from bs4 import BeautifulSoup
import lxml
VkSession = vk_api.VkApi('', '')
VkSession.auth()
vk = 'https://vk.com/'
VKID = Bot.VkId
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0'
}
req = requests.get(vk, headers = headers)
src = req.text
soup = BeautifulSoup(src, "lxml")
div = soup.find_all('div', class_ = "labeled")