def run(self): print('[::LP] run()') self.print("Getting LongPoolServerObject...") # Getting VK API Instance... api = vk.API(vk.Session(access_token=self.account.token)) # Getting VK Long pool server lpserver = api.messages.getLongPollServer() # Getting LongPoolServerObject from response self.lpso = LongPoolThread.LongPoolServerObject.from_json(lpserver) self.lpso.timeout = self.timeout self.print("OK") while self.enabled: # Getting server request url rurl = self.lpso.format() # Getting Response resp = json.loads(requests.get(rurl).text) # Cancel response processing if thread is stopped if self.enabled: # Processing VK updates if "updates" in resp: self.on_response(resp['updates']) # Updating LongPoolServerObject self.lpso.ts = resp['ts'] else: print("cant find updates, restartin' thread") console = bot_console.Console() console.run("longpool restart") pass
def create_console(acc): global bot_console_instance try: bot_console_instance = bot_console.Console() bot_console_instance.acc = acc bot_console_instance.acc_number = num bot_console_instance.run_looped() except Exception as e: print(e) create_console(acc) pass
def main(cmd): if not "chacc" in cmd: return None print("Exiting all threads...") # Before changing accs, close all threads con = bot_console.Console() if bot_header.LONG_POOL_THREAD_INSTANCE is not None: con.run("longpool stop") if bot_header.SET_ONLINE_THREAD_INSTANCE is not None: con.run("setonline stop") bot_header.CURRENT_ACCOUNT = None # Restart it bot.bot_entry()
def exec_rule(self, rule): try: print("Executing rule #%s" % rule.id) if rule.action is not None: if rule.action == AutoexecActionType.ACTION_HC_CONSOLE: if rule.action_value is not None: from console import bot_console bot_console.Console().run(rule.action_value) else: print("Bad rule #%s (No action value)") else: print("Bad rule #%s (No action)") pass except Exception as e: print(e) pass
def main(c): console = bot_console.Console() console.run("modules load -a")
def main(c): console = bot_console.Console() console.run("longpool stop") console.run("longpool start")
def main(c): console = bot_console.Console() console.run("aexec stop") console.run("aexec start")