mirror of
https://gitlab.com/MisterBiggs/multi-bot-tutorial.git
synced 2025-06-15 14:46:41 +00:00
added about command
This commit is contained in:
parent
c5bc1ddd9b
commit
5617e6cf29
@ -3,12 +3,11 @@ import logging
|
||||
import os
|
||||
|
||||
import telegram
|
||||
from functions import nextLaunch, roadster
|
||||
from telegram.ext import CommandHandler, Filters, MessageHandler, Updater
|
||||
|
||||
from functions import about, nextLaunch, roadster
|
||||
|
||||
TELEGRAM_TOKEN = os.environ["TELEGRAM"]
|
||||
TELEGRAM_TOKEN = "TOKEN"
|
||||
|
||||
# Enable logging
|
||||
logging.basicConfig(
|
||||
@ -42,6 +41,15 @@ def roadster_reply(bot, update):
|
||||
update.message.reply_text(text=message, parse_mode=telegram.ParseMode.MARKDOWN)
|
||||
|
||||
|
||||
def about_reply(bot, update):
|
||||
about_data = about()
|
||||
message = f"**About**\n"
|
||||
message += f"{about_data['description']}\n\n"
|
||||
message += f"[Blog Post]({about_data['blogPost']})\n"
|
||||
message += f"[Repo]({about_data['repo']})"
|
||||
update.message.reply_text(text=message, parse_mode=telegram.ParseMode.MARKDOWN)
|
||||
|
||||
|
||||
def error(bot, update, error):
|
||||
"""Log Errors caused by Updates."""
|
||||
logger.warning('Update "%s" caused error "%s"', update, error)
|
||||
@ -59,8 +67,9 @@ def main():
|
||||
dp.add_handler(CommandHandler("start", start))
|
||||
dp.add_handler(CommandHandler("launch", nextRocketLaunch))
|
||||
dp.add_handler(CommandHandler("roadster", roadster_reply))
|
||||
dp.add_handler(CommandHandler("about", about_reply))
|
||||
|
||||
# log all errors
|
||||
# log all errorsc
|
||||
dp.add_error_handler(error)
|
||||
|
||||
# Start the Bot
|
||||
|
Loading…
x
Reference in New Issue
Block a user