Add greeting message

This commit is contained in:
coolneng 2020-10-27 01:05:56 +01:00
parent 5d0424045d
commit 7b2981bb8c
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
3 changed files with 45 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
src/constants.py

13
shell.nix Normal file
View File

@ -0,0 +1,13 @@
{ pkgs ? import <nixpkgs> { } }:
with pkgs;
mkShell {
buildInputs = [
python38
python38Packages.python-telegram-bot
python38Packages.aiosmtpd
python38Packages.pytest
];
}

31
src/bot.py Normal file
View File

@ -0,0 +1,31 @@
from telegram.ext import Updater, CommandHandler
from constants import TOKEN
def initialize_bot():
updater = Updater(token=TOKEN, use_context=True)
dispatcher = updater.dispatcher
return updater, dispatcher
def start_callback(update, context):
context.bot.send_message(
chat_id=update.effective_chat.id,
text="Hola, muy buenas. Gracias por ponerte en contacto con UGR Tracing Bot. Para poder continuar con el proceso por favor responda a este mensaje con un identificador único (DNI o correo institucional). Muchas gracias.",
)
def add_callbacks(dispatcher):
start_handler = CommandHandler("start", start_callback)
dispatcher.add_handler(start_handler)
def main():
updater, dispatcher = initialize_bot()
add_callbacks(dispatcher)
updater.start_polling()
updater.idle()
if __name__ == "__main__":
main()