Add /start. Add gitignore, sample.config.py.

This commit is contained in:
Ceda EI 2018-10-17 20:22:21 +05:30
parent e1105eecfb
commit 7311184d4d
3 changed files with 35 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
config.py
__pycache__/

30
bot.py Normal file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
import logging
from telegram.ext import Updater, CommandHandler
try:
import config
except ImportError:
print("Missing Config. Exiting.")
exit()
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - \
%(message)s', level=logging.INFO)
def start(bot, update):
chat_id = update.message.chat_id
name = update.message.message
text = f"Hello {name}!\n" + \
"Welcome to Questable. To get started, check /help."
bot.send_message(chat_id=chat_id, text=text)
updater = Updater(token=config.api_key)
dispatcher = updater.dispatcher
start_handler = CommandHandler('start', start)
dispatcher.add_handler(start_handler)
updater.start_polling()

3
sample.config.py Normal file
View File

@ -0,0 +1,3 @@
# Create a new bot by messaging @BotFather and follow the instructions
# Replace the key by the actual token recieved from BotFather
api_key = "123456789:xxxxxxxxxxxxxxxxxxxxxxxxxxxx"