from aiogram import types, Dispatcher, executor, Bot
TOKEN = " "
bot = Bot(TOKEN)
dp = Dispatcher(bot)
@dp.message_handler(text='hello') # text='hello' Здесь укажи на какой текст должен отвечать бот
async def start(message: types.Message):
await bot.send_message(message.chat.id, 'jojo')
if __name__ == '__main__':
executor.start_polling(dp)
message.content
@bot.event
async def on_message(message):
if "привет" in str(message.content).lower():
await message.channel.send("Привет, друг")
.lover()
и все будет работать хорошо.lover()
@bot.event
async def on_message(message):
if "привет" in str(message.content):
await message.channel.send("Привет, друг")
import requests
from bs4 import BeautifulSoup
url = requests.get('http://almetpt.ru/2020/site/schedule/group/835')
print(url.status_code)
soup = BeautifulSoup(url.text, "html.parser")
allNews = soup.findAll('div', class_='container')
# цикл
for text_all in allNews:
print(text_all.text)
import requests
from bs4 import BeautifulSoup
url = requests.get('http://almetpt.ru/2020/site/schedule/group/835')
print(url.status_code)
soup = BeautifulSoup(url.text, "html.parser")
allNews = soup.findAll('div', class_='container')
print(allNews[0].text)
@dp.message_handler(text=['Магазин'])
async def shop(message: types.Message):
await message.answer("Выберите подраздел: ", reply_markup=inline_kb_full2)
@dp.callback_query_handler(lambda c: c.data == 'A')
async def process_callback_button1(callback_query: types.CallbackQuery):
await bot.answer_callback_query(callback_query.id)
await bot.send_message(callback_query.from_user.id, 'Нажата первая кнопка!', reply_markup=inline_kb_full3)
@dp.callback_query_handler(lambda c: c.data == 'A')
async def process_callback_button1(callback_query: types.CallbackQuery):
await bot.answer_callback_query(callback_query.id)
await bot.send_message(callback_query.from_user.id, 'Нажата первая кнопка!', reply_markup=inline_kb_full3)
from aiogram import Bot, Dispatcher, executor, types
from config import TOKEN
bot = Bot(TOKEN)
dp = Dispatcher(bot)
@dp.message_handler()
async def tex(message: types.Message):
await bot.send_message(message.chat.id, message.text)
with open('tee.txt', 'a+') as file_tee:
file_tee.write(f'{message.from_user.first_name} - {message.text}\n')
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
with open('tee.txt', 'a+') as file_tee:
file_tee.write(f'{message.from_user.first_name} - {message.text}\n')
from aiogram import Bot, Dispatcher, executor, types
import openpyxl
TOKEN = "Ваш токен"
book = openpyxl.open("Имя вашего exl файла", read_only=True)
shet = book.active
bot = Bot(TOKEN)
dp = Dispatcher(bot)
@dp.message_handler()
async def bot_start(message: types.Message):
for ino in shet:
surname_ = ino[0].value
number_ = str(ino[1].value)
addresses_ = ino[2].value
sum_ = ino[3].value
if message.text in number_:
await bot.send_message(message.chat.id, f'Фамилия: {surname_}\nНомер телефона: {number_}\nАдрес: {addresses_}\nСумма: {sum_}')
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True)
if message.text in number_:
await bot.send_message(message.chat.id, f'Фамилия: {surname_}\nНомер телефона: {number_}\nАдрес: {addresses_}\nСумма: {sum_}')