You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
538 B
22 lines
538 B
import settings |
|
import asyncio |
|
from telethon import TelegramClient, events |
|
|
|
from aiohttp import web |
|
|
|
bot = TelegramClient('data/bot', settings.API_ID, settings.API_HASH).start(bot_token=settings.API_TOKEN) |
|
|
|
@bot.on(events.NewMessage(incoming=True)) |
|
async def new_message(event): |
|
text = event.raw_text |
|
print(text) |
|
|
|
async def submit(request): |
|
data = await request.post() |
|
print(data) |
|
|
|
if __name__ == '__main__': |
|
bot.start() |
|
app = web.Application() |
|
app.router.add_post('/', submit) |
|
web.run_app(app, port=8123)
|
|
|