mirror of
https://gitlab.com/MisterBiggs/multi-bot-tutorial.git
synced 2025-06-15 22:56:45 +00:00
made directory structure and functions
This commit is contained in:
parent
83d69a7502
commit
dc844dd812
0
discord/discord.py
Normal file
0
discord/discord.py
Normal file
0
discord/requirements.txt
Normal file
0
discord/requirements.txt
Normal file
28
functions.py
Normal file
28
functions.py
Normal file
@ -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
|
||||
|
0
telegram/requirements.txt
Normal file
0
telegram/requirements.txt
Normal file
14
telegram/telegram.py
Normal file
14
telegram/telegram.py
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user