def settinggraphichours(bot, chat_id, msg): bot.sendChatAction(chat_id, 'typing') if msg['text'] == 'Cancel': MyGlobals.currentMenu = 'Settings' bot.sendMessage(chat_id, "All set!", reply_markup=myKeyboard) else: try: if float(msg['text']) < 240 * 3600: config.setConfig('settings.ini', 'Graph', 'length', round(float(msg['text']) * 3600)) config.loadSettings('settings.ini') bot.sendMessage(chat_id, "All set!", reply_markup=myKeyboard) MyGlobals.currentMenu = 'Settings' else: 1 / 0 except: bot.sendMessage(chat_id, "Please send a number of hours below 240")
def settingcputh(bot, chat_id, msg): bot.sendChatAction(chat_id, 'typing') if msg['text'] == 'Cancel': MyGlobals.currentMenu = 'Settings' bot.sendMessage(chat_id, "All set!", reply_markup=myKeyboard) else: try: if int(msg['text']) < 100: config.setConfig('settings.ini', 'Graph', 'cputh', int(msg['text'])) config.loadSettings('settings.ini') bot.sendMessage(chat_id, "All set!", reply_markup=myKeyboard) MyGlobals.currentMenu = 'Settings' else: 1 / 0 except: bot.sendMessage(chat_id, "Please send a proper numeric value below 100.")
# -*- coding: utf-8 -*- import botfunction as funk import os import botConfig as config if __name__ == "__main__": pid = os.getpid() op = open("ssb.pid", "w") op.write("%s" % pid) op.close() if not config.exist('settings.ini'): config.createConfig('settings.ini') config.loadSettings('settings.ini') funk.main()