mercatus/Utils.py

18 lines
462 B
Python
Raw Normal View History

2019-06-12 21:31:06 +02:00
from telegram import Update
from telegram.ext import PicklePersistence
from yaml import load, Loader
from enum import Enum
config = load(open('./config.yml', 'r'), Loader=Loader)
persistence = PicklePersistence('./data/mercatus')
class Section(Enum):
Watchlist = 'watchlist'
API_Key = 'api_key'
def parse_command(update: Update) -> (str, str):
key, value = (update.message.text.split(' ', 1)[1].split(' ', 1) + [None])[:2]
return key, value