parent
be038a90f5
commit
8d71f71a1d
2 changed files with 23 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||||||
|
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) |
Loading…
Reference in new issue