how to use send_message() in python-telegram-bot

i want to send a message to user, without waiting for user triggered my bot. using send_message(), i've been read the documentation but i'm not really understand. Here's my code

from dotenv import load_dotenv
from telegram.ext import *
from telegram import InputFile, Bot
import os
import re

command = ['start']

load_dotenv()

tokenize = os.getenv("TELEGRAM_BOT_TOKEN")

async def start_commmand(update, context):
    umsg = update.message
    await umsg.reply_text("Welcome, i'll help u with ur schedule")


if __name__ == "__main__":
    application = Application.builder().token(tokenize).build()

    application.add_handler(CommandHandler(command[0], start_commmand))

    # Run bot
    application.run_polling(1.0)

i tried to send a message to bot user using send_mesage(), i hope it's send a message without waiting any message from user. because i'm not really understand after read the documentation, i don't know how to do it



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation