From 7b2981bb8cd3ae81f07380a172b39e7235569fcb Mon Sep 17 00:00:00 2001
From: coolneng <akasroua@gmail.com>
Date: Tue, 27 Oct 2020 01:05:56 +0100
Subject: [PATCH] Add greeting message

---
 .gitignore |  1 +
 shell.nix  | 13 +++++++++++++
 src/bot.py | 31 +++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 shell.nix
 create mode 100644 src/bot.py

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c9fd099
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+src/constants.py
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..60b31c2
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,13 @@
+{ pkgs ? import <nixpkgs> { } }:
+
+with pkgs;
+
+mkShell {
+  buildInputs = [
+    python38
+    python38Packages.python-telegram-bot
+    python38Packages.aiosmtpd
+    python38Packages.pytest
+  ];
+
+}
diff --git a/src/bot.py b/src/bot.py
new file mode 100644
index 0000000..3007303
--- /dev/null
+++ b/src/bot.py
@@ -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()