Skip to content

Bokoto.py #2

@Onaliko

Description

@Onaliko

import logging
from telegram.ext import Updater, CommandHandler
import requests

Define the URL upload function

def upload_url(bot, update):
text = update.message.text
url = text[8:] # remove the "/upload " prefix
# Upload the URL to a cloud storage service (e.g. Google Drive)
# Then, send the file link to the user using the Telegram Bot API
bot.send_message(chat_id=update.message.chat_id, text="The URL has been uploaded.\nFile link: <file_link>")

Set up the Telegram Bot API

updater = Updater(token='5857821445:AAHrCIPNR2rbxB0b4g2iXsIbWn56DYkSy7c')
dispatcher = updater.dispatcher

Add a command handler for the "/upload" command

upload_handler = CommandHandler('upload', upload_url)
dispatcher.add_handler(upload_handler)

Start the bot

updater.start_polling()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions