I have a telegram chatbot in python
in this bot I can make it auto reply on users if users input limited words by give them Specific options for to choose one of them .
my question is can I make it in Ms access database.
I have already Ms access database it is sending pictures and messages
to telegram bot but I want make my bot to auto reply in users as python language
in python language i use similar this
in this bot I can make it auto reply on users if users input limited words by give them Specific options for to choose one of them .
my question is can I make it in Ms access database.
I have already Ms access database it is sending pictures and messages
to telegram bot but I want make my bot to auto reply in users as python language
in python language i use similar this
Python:
from telegram.ext import *
from datetime import datetime
def sample_responses(input_text):
user_message =str(input_text).lower()
if user_message in ("hi","hello","helo",):
return (
f"click 1 to info\ninput 2 to get date and time\ninput 3 to get my web site")
if user_message in ("1"):
return "this bot for ........"
if user_message in ("2"):
now =datetime .now()
date_time=now.strftime("%d/%m/%y, %H:%M:%S")
return str(date_time)
if user_message in ("3"):
return "https://www.access-programmers.co.uk"
return(f"i can not understand you input 1,2 or3")
print ("bot starting.....")
def start_command (update,context):
update.message.reply_text (f'this bot for......')
def help_command (update,context):
update.message.reply_text ('ask google')
def handle_message(update,context):
text=str(update.message.text).lower()
response=sample_responses(text)
update.message.reply_text(response)
def error(update,context):
print(f"update {update} caused error {context.error}")
def main():
updater =Updater("YOR Telegram bot API token",use_context=True)
dp= updater.dispatcher
dp.add_handler (CommandHandler("start",start_command))
dp.add_handler(CommandHandler("start",help_command))
dp.add_handler(MessageHandler(Filters.text,handle_message))
dp.add_error_handler(error)
updater.start_polling()
updater.idle()
main()