making telegram chatbot as python (1 Viewer)

ayamnash

New member
Local time
Yesterday, 22:37
Joined
Sep 23, 2016
Messages
29
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
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()
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:37
Joined
Oct 29, 2018
Messages
21,477
Basically, you want to convert your code into VBA, right? I don't see why not. It should be possible.
 

ayamnash

New member
Local time
Yesterday, 22:37
Joined
Sep 23, 2016
Messages
29
Basically, you want to convert your code into VBA, right? I don't see why not. It should be possible.
the main problem is i am using telegram.ext library in python but i dont know What is the equivalent library in ms access if it exist!
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:37
Joined
Oct 29, 2018
Messages
21,477
the main problem is i am using telegram.ext library in python but i dont know What is the equivalent library in ms access if it exist!
What kind of a file is telegram.ext?
 

ayamnash

New member
Local time
Yesterday, 22:37
Joined
Sep 23, 2016
Messages
29
It is a package
A package is a collection of related modules that work together to provide certain functionality. These modules are contained within a folder and can be imported just like any other modules. This folder will often contain a special __init__ file that tells Python it’s a package, potentially containing more modules nested within subfolders
Telegram.ext package

https://python-telegram-bot.readthedocs.io/en/stable/telegram.ext.html
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:37
Joined
Oct 29, 2018
Messages
21,477
It is a package
A package is a collection of related modules that work together to provide certain functionality. These modules are contained within a folder and can be imported just like any other modules. This folder will often contain a special __init__ file that tells Python it’s a package, potentially containing more modules nested within subfolders
Telegram.ext package

https://python-telegram-bot.readthedocs.io/en/stable/telegram.ext.html
Okay, I'm not too familiar with that. If you can open each package, is it just a collection of python code? In other words, are they basically just text files?
 

ayamnash

New member
Local time
Yesterday, 22:37
Joined
Sep 23, 2016
Messages
29
Okay, I'm not too familiar with that. If you can open each package, is it just a collection of python code? In other words, are they basically just text files?
Yes i think that. It is a croup of codes makes to easier for the users
 
Last edited:

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:37
Joined
Oct 29, 2018
Messages
21,477
Yes i think that. It is a croup of codes makes to easier for the users
Okay. In that case, I think what you need is someone who is familiar with both python and vba to translate the python language into vba.

Unfortunately, I am only slightly familiar with python, so I don't think I'm qualified to do this job for you. Good luck!
 

ayamnash

New member
Local time
Yesterday, 22:37
Joined
Sep 23, 2016
Messages
29
no problem,
I searched all the forums and couldn't find anyone who looking into this case
 

Users who are viewing this thread

Top Bottom