Esempio n. 1
0
def ticker(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply_markup = ReplyKeyboardMarkup([['/tickers'], ['/home']])
    fund_id = str(update.message.text).replace('/tick_', '')
    bot.sendMessage(update.message.chat_id,
                    text=pytrtbot.Ticker(fund_id),
                    reply_markup=reply_markup)
Esempio n. 2
0
def ticker(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply_markup = ReplyKeyboardMarkup([['/tickers'], ['/home']])
    fund_id = str(update.message.text).replace('/tick_', '')
    bot.sendMessage(update.message.chat_id,
                    text=pytrtbot.Ticker(fund_id),
                    reply_markup=reply_markup)
Esempio n. 3
0
def signup(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    userId = str(update.message.from_user.id)
    db = pickledb.load('db/users.db', False)
    try:
        if db.get(userId)['register']:
            key = update.message.text.split()[0]
            secret = update.message.text.split()[1]
            insertApiKey = {
                'apikey': key,
                'apisecret': secret,
                'register': False
            }
            db.set(userId, insertApiKey)
            db.dump()
            reply_markup = ReplyKeyboardMarkup([['/balances'], ['/home']])
            bot.sendMessage(update.message.chat_id,
                            text='User registered! Use /balances to try it',
                            reply_markup=reply_markup)
    except:
        reply_markup = ReplyKeyboardMarkup([['/register'],
                                            ['/home'],
                                            ['/help']])
        bot.sendMessage(update.message.chat_id,
                        text='You can register! Type /register ' +
                             'and follow the instructions',
                        reply_markup=reply_markup)
Esempio n. 4
0
def signup(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    userId = str(update.message.from_user.id)
    db = pickledb.load('db/users.db', False)
    try:
        if db.get(userId)['register']:
            key = update.message.text.split()[0]
            secret = update.message.text.split()[1]
            insertApiKey = {
                'apikey': key,
                'apisecret': secret,
                'register': False
            }
            db.set(userId, insertApiKey)
            db.dump()
            reply_markup = ReplyKeyboardMarkup([['/balances'], ['/home']])
            bot.sendMessage(update.message.chat_id,
                            text='User registered! Use /balances to try it',
                            reply_markup=reply_markup)
    except:
        reply_markup = ReplyKeyboardMarkup([['/register'], ['/home'],
                                            ['/help']])
        bot.sendMessage(update.message.chat_id,
                        text='You can register! Type /register ' +
                        'and follow the instructions',
                        reply_markup=reply_markup)
Esempio n. 5
0
def bitcoinData(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply_markup = ReplyKeyboardMarkup([['/home']])
    text = pytrtbot.bitcoinData()
    bot.sendMessage(update.message.chat_id,
                    text=text,
                    reply_markup=reply_markup)
Esempio n. 6
0
def register(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    db = pickledb.load('db/users.db', False)
    db.set(update.message.from_user.id, REG)
    db.dump()
    reply_markup = ReplyKeyboardHide()
    bot.sendMessage(update.message.chat_id,
                    text='Send your public API Key and API ' +
                    'secret, with a space between them.',
                    reply_markup=reply_markup)
Esempio n. 7
0
def register(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    db = pickledb.load('db/users.db', False)
    db.set(update.message.from_user.id, REG)
    db.dump()
    reply_markup = ReplyKeyboardHide()
    bot.sendMessage(update.message.chat_id,
                    text='Send your public API Key and API ' +
                    'secret, with a space between them.',
                    reply_markup=reply_markup)
Esempio n. 8
0
def deleteKeys(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    db = pickledb.load('db/users.db', False)
    db.rem(str(update.message.from_user.id))
    db.dump()
    reply_markup = ReplyKeyboardMarkup([['/price', '/tickers'],
                                        ['/bitcoin_data'],
                                        ['/register', '/help']])
    bot.sendMessage(update.message.chat_id,
                    text='Your keys are deleted. You can use the bot anyway!',
                    reply_markup=reply_markup)
Esempio n. 9
0
def discounts(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply = 'Select a currency to get info on your discounts!'
    reply_markup = ReplyKeyboardMarkup([['/disc_BTC', '/disc_EUR'],
                                        ['/disc_USD', '/disc_LTC'],
                                        ['/disc_XRP', '/disc_NMC'],
                                        ['/disc_PPC', '/disc_DOGE'],
                                        ['/home']])
    bot.sendMessage(update.message.chat_id,
                    text=reply,
                    reply_markup=reply_markup)
Esempio n. 10
0
def discounts(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply = 'Select a currency to get info on your discounts!'
    reply_markup = ReplyKeyboardMarkup([['/disc_BTC', '/disc_EUR'],
                                        ['/disc_USD', '/disc_LTC'],
                                        ['/disc_XRP', '/disc_NMC'],
                                        ['/disc_PPC', '/disc_DOGE'],
                                        ['/home']])
    bot.sendMessage(update.message.chat_id,
                    text=reply,
                    reply_markup=reply_markup)
Esempio n. 11
0
def deleteKeys(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    db = pickledb.load('db/users.db', False)
    db.rem(str(update.message.from_user.id))
    db.dump()
    reply_markup = ReplyKeyboardMarkup([['/price', '/tickers'],
                                        ['/bitcoin_data'],
                                        ['/register', '/help']])
    bot.sendMessage(update.message.chat_id,
                    text='Your keys are deleted. You can use the bot anyway!',
                    reply_markup=reply_markup)
Esempio n. 12
0
def tickers(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply = 'Select a fund to get some info on it!'
    reply_markup = ReplyKeyboardMarkup([['/tick_BTCEUR', '/tick_BTCUSD'],
                                        ['/tick_LTCEUR', '/tick_LTCBTC'],
                                        ['/tick_BTCXRP', '/tick_EURXRP'],
                                        ['/tick_USDXRP', '/tick_LTCUSD'],
                                        ['/tick_NMCBTC', '/tick_PPCEUR'],
                                        ['/tick_EURDOG', '/tick_PPCBTC'],
                                        ['/tick_BTCDOG', '/home']])
    bot.sendMessage(update.message.chat_id,
                    text=reply,
                    reply_markup=reply_markup)
Esempio n. 13
0
def orders(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply = 'Select a fund to get your orders!'
    reply_markup = ReplyKeyboardMarkup([['/ord_BTCEUR', '/ord_BTCUSD'],
                                        ['/ord_LTCEUR', '/ord_LTCBTC'],
                                        ['/ord_BTCXRP', '/ord_EURXRP'],
                                        ['/ord_USDXRP', '/ord_LTCUSD'],
                                        ['/ord_NMCBTC', '/ord_PPCEUR'],
                                        ['/ord_EURDOG', '/ord_PPCBTC'],
                                        ['/ord_BTCDOG', '/home']])
    bot.sendMessage(update.message.chat_id,
                    text=reply,
                    reply_markup=reply_markup)
Esempio n. 14
0
def tickers(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply = 'Select a fund to get some info on it!'
    reply_markup = ReplyKeyboardMarkup([['/tick_BTCEUR', '/tick_BTCUSD'],
                                        ['/tick_LTCEUR', '/tick_LTCBTC'],
                                        ['/tick_BTCXRP', '/tick_EURXRP'],
                                        ['/tick_USDXRP', '/tick_LTCUSD'],
                                        ['/tick_NMCBTC', '/tick_PPCEUR'],
                                        ['/tick_EURDOG', '/tick_PPCBTC'],
                                        ['/tick_BTCDOG', '/home']])
    bot.sendMessage(update.message.chat_id,
                    text=reply,
                    reply_markup=reply_markup)
Esempio n. 15
0
def orders(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply = 'Select a fund to get your orders!'
    reply_markup = ReplyKeyboardMarkup([['/ord_BTCEUR', '/ord_BTCUSD'],
                                        ['/ord_LTCEUR', '/ord_LTCBTC'],
                                        ['/ord_BTCXRP', '/ord_EURXRP'],
                                        ['/ord_USDXRP', '/ord_LTCUSD'],
                                        ['/ord_NMCBTC', '/ord_PPCEUR'],
                                        ['/ord_EURDOG', '/ord_PPCBTC'],
                                        ['/ord_BTCDOG', '/home']])
    bot.sendMessage(update.message.chat_id,
                    text=reply,
                    reply_markup=reply_markup)
Esempio n. 16
0
def help(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    db = pickledb.load('db/users.db', False)
    userId = str(update.message.from_user.id)
    try:
        registered = not db.get(userId)['register']
    except:
        registered = False
    if registered:
        reply_markup = ReplyKeyboardMarkup([['/delete_keys'], ['/home']])
    else:
        reply_markup = ReplyKeyboardMarkup([['/home']])
    bot.sendMessage(update.message.chat_id,
                    text=pytrtbot.Help(),
                    reply_markup=reply_markup)
Esempio n. 17
0
def help(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    db = pickledb.load('db/users.db', False)
    userId = str(update.message.from_user.id)
    try:
        registered = not db.get(userId)['register']
    except:
        registered = False
    if registered:
        reply_markup = ReplyKeyboardMarkup([['/delete_keys'],
                                            ['/home']])
    else:
        reply_markup = ReplyKeyboardMarkup([['/home']])
    bot.sendMessage(update.message.chat_id,
                    text=pytrtbot.Help(),
                    reply_markup=reply_markup)
Esempio n. 18
0
def transactions(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    userId = str(update.message.from_user.id)
    db = pickledb.load('db/users.db', False)
    try:
        apikey = db.get(userId)['apikey']
        apisecret = db.get(userId)['apisecret']
        markup, reply = pytrtbot.MyTransactions(apikey, apisecret)
        reply_markup = ReplyKeyboardMarkup([[markup]])
        bot.sendMessage(update.message.chat_id,
                        text=reply,
                        reply_markup=reply_markup)
    except:
        reply_markup = ReplyKeyboardMarkup([['/register'], ['/home']])
        bot.sendMessage(update.message.chat_id,
                        text='You must register! Type /register ' +
                        'and follow the instructions',
                        reply_markup=reply_markup)
Esempio n. 19
0
def transactions(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    userId = str(update.message.from_user.id)
    db = pickledb.load('db/users.db', False)
    try:
        apikey = db.get(userId)['apikey']
        apisecret = db.get(userId)['apisecret']
        markup, reply = pytrtbot.MyTransactions(apikey, apisecret)
        reply_markup = ReplyKeyboardMarkup([[markup]])
        bot.sendMessage(update.message.chat_id,
                        text=reply,
                        reply_markup=reply_markup)
    except:
        reply_markup = ReplyKeyboardMarkup([['/register'], ['/home']])
        bot.sendMessage(update.message.chat_id,
                        text='You must register! Type /register ' +
                             'and follow the instructions',
                        reply_markup=reply_markup)
Esempio n. 20
0
def home(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    db = pickledb.load('db/users.db', False)
    userId = str(update.message.from_user.id)
    try:
        registered = not db.get(userId)['register']
    except:
        registered = False
    if registered:
        reply_markup = ReplyKeyboardMarkup([['/price', '/tickers'],
                                            ['/balances', '/discounts'],
                                            ['/trades', '/transactions'],
                                            ['/orders', '/bitcoin_data'],
                                            ['/help']])
    else:
        reply_markup = ReplyKeyboardMarkup([['/price', '/tickers'],
                                            ['/bitcoin_data'],
                                            ['/register', '/help']])
    bot.sendMessage(update.message.chat_id,
                    text=pytrtbot.Home(),
                    reply_markup=reply_markup)
Esempio n. 21
0
def home(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    db = pickledb.load('db/users.db', False)
    userId = str(update.message.from_user.id)
    try:
        registered = not db.get(userId)['register']
    except:
        registered = False
    if registered:
        reply_markup = ReplyKeyboardMarkup([['/price', '/tickers'],
                                            ['/balances', '/discounts'],
                                            ['/trades', '/transactions'],
                                            ['/orders', '/bitcoin_data'],
                                            ['/help']])
    else:
        reply_markup = ReplyKeyboardMarkup([['/price', '/tickers'],
                                            ['/bitcoin_data'],
                                            ['/register', '/help']])
    bot.sendMessage(update.message.chat_id,
                    text=pytrtbot.Home(),
                    reply_markup=reply_markup)
Esempio n. 22
0
def bitcoinData(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply_markup = ReplyKeyboardMarkup([['/home']])
    text = pytrtbot.bitcoinData()
    bot.sendMessage(update.message.chat_id,
                    text=text, reply_markup=reply_markup)
Esempio n. 23
0
def price(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply_markup = ReplyKeyboardMarkup([['/home']])
    bot.sendMessage(update.message.chat_id,
                    text=pytrtbot.Last(),
                    reply_markup=reply_markup)
Esempio n. 24
0
def error(bot, update, error):
    pytrtbot.writedb(update.message.to_dict())
    logger.warn('Update "%s" caused error "%s"' % (update, error))
Esempio n. 25
0
def error(bot, update, error):
    pytrtbot.writedb(update.message.to_dict())
    logger.warn('Update "%s" caused error "%s"' % (update, error))
Esempio n. 26
0
def price(bot, update):
    pytrtbot.writedb(update.message.to_dict())
    reply_markup = ReplyKeyboardMarkup([['/home']])
    bot.sendMessage(update.message.chat_id,
                    text=pytrtbot.Last(),
                    reply_markup=reply_markup)