diff --git a/discord/discord.py b/discord/discord.py new file mode 100644 index 0000000..e69de29 diff --git a/discord/requirements.txt b/discord/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/functions.py b/functions.py new file mode 100644 index 0000000..b5ca788 --- /dev/null +++ b/functions.py @@ -0,0 +1,28 @@ +import requests +from datetime import datetime + + +def nextLaunch(): + + url = "https://launchlibrary.net/1.4/launch/next/1?mode=list" + response = requests.get(url) + + if response.status_code is 200: + data = response.json()["launches"][0] + + rocket, mission = data["name"].split("|") + date = data["net"] + countdown = datetime.strptime(date, "%B %d, %Y %H:%M:%S %Z") - datetime.today() + + else: + print("error") + + launch = { + "rocket": rocket, + "mission": mission, + "date": date, + "countdown": str(countdown), + "video": data["vidURLs"][0], + } + return launch + diff --git a/telegram/requirements.txt b/telegram/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/telegram/telegram.py b/telegram/telegram.py new file mode 100644 index 0000000..9c2b884 --- /dev/null +++ b/telegram/telegram.py @@ -0,0 +1,14 @@ +import telegram +from telegram.ext import Updater, CommandHandler + + +def hello(bot, update): + update.message.reply_text("Hello {}".format(update.message.from_user.first_name)) + + +updater = Updater("YOUR TOKEN HERE") + +updater.dispatcher.add_handler(CommandHandler("hello", hello)) + +updater.start_polling() +updater.idle()