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.
 

33 lines
986 B

import logging
from telegram import Update
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
print(update)
print(update.effective_chat.id)
await context.bot.send_message(
chat_id=update.effective_chat.id, text="I'm a bot, please talk to me!"
)
async def location(update: Update, context: ContextTypes.DEFAULT_TYPE):
locs = updates[0]
await context.bot.send_location(
chat_id=update.effective_chat.id, latitude=locs["lat"], longitude=locs["lon"]
)
if __name__ == "__main__":
application = (
ApplicationBuilder()
.token("6215777004:AAHUiOAeAuHAGzuNtGnQSlVUJ56nXUnWUms")
.build()
)
start_handler = CommandHandler("start", start)
location_handler = CommandHandler("location", location)
application.add_handler(start_handler)
application.add_handler(location_handler)
application.run_polling()