def main(): bot = Bot() try: bot.dispatch() except KeyboardInterrupt: bot.thread.stop()
#!/usr/bin/env python from lib.bot import Bot from dotenv import load_dotenv, find_dotenv import logging import os VERSION = "0.2.1" load_dotenv(find_dotenv()) logging.basicConfig(level=os.getenv("LOGLEVEL", "INFO"), format="%(levelname)s %(asctime)s [%(name)s] %(message)s") bot = Bot() bot.run(VERSION)
from lib.bot import Bot from telegram.ext import MessageHandler, Filters, CallbackQueryHandler from lib import handler from lib.triggers import listeners from lib.triggers.features.controller import features_handler from lib.triggers.listeners import callback_handler # Init Bot bot = Bot() # add Triggers bot.addHandler(MessageHandler, listeners.bots, Filters.status_update, pass_job_queue=True) # features bot.addHandler(MessageHandler, features_handler, Filters.photo) # add Handler bot.addHandler( MessageHandler, handler.dispatcher, Filters.all, ) # callback handler bot.addHandler(CallbackQueryHandler, callback_handler) # start bot bot.start()
def updateCSRFHeaders(): global userSession, configValues # get page and check for change of token def store_all_and_logout(botClass): botClass.store_queue() botClass.logout() if __name__ == '__main__': argv = sys.argv[1:] mainBot = Bot() mainBot.addEnviromentVariable(key="configFile", value=None) mainBot.addEnviromentVariable(key="userSession", value=requests.Session()) mainBot.addEnviromentVariable(key="configValues", value={ "paramsLogin": { 'authenticity_token': '', 'session[email]': '', 'session[password]': '' }, "csrfHeaders": { 'X-CSRF-Token': '', 'X-Requested-With': 'XMLHttpRequest' } })
return response def updateCSRFHeaders(): global userSession, configValues # get page and check for change of token def store_all_and_logout(botClass): botClass.store_queue() botClass.logout() if __name__ == '__main__': argv = sys.argv[1:] mainBot = Bot() mainBot.addEnviromentVariable(key="configFile", value=None) mainBot.addEnviromentVariable(key="userSession", value=requests.Session()) mainBot.addEnviromentVariable(key="configValues", value={ "paramsLogin": { 'authenticity_token': '', 'session[email]': '', 'session[password]': '' }, "csrfHeaders": { 'X-CSRF-Token': '', 'X-Requested-With': 'XMLHttpRequest' } })
from lib.bot import Bot bot = Bot(throttle=15) bot.login() self = bot.get_user() followed = bot.get_user_following(id=self["id"], full=False) count = 0 for user in followed: bot.do_unfollow(user["username"]) count = count + 1 bot.halt()
if not os.path.exists(new_dir): os.mkdir(new_dir) git.Git(new_dir).clone("https://github.com/ManKwang/amino-bot.git") print('Репозиторий был клонирован в новую папку: ' + new_dir) print('Используйте эту папку для работы с ботом') os.startfile(new_dir + '/amino-bot') exit() # ---------------- !Получение обновлений # Initialize the bot bot = Bot() if __name__ == '__main__': DIR_LOGS = os.getcwd() + '/logs' if not os.path.exists(DIR_LOGS): os.mkdir(DIR_LOGS) DIR_LEN = len([ name for name in os.listdir(DIR_LOGS) if os.path.isfile(os.path.join(DIR_LOGS, name)) ]) logging.basicConfig(handlers=[ logging.FileHandler(f"logs/log_{str(DIR_LEN + 1)}.txt", 'w', 'utf-8') ],
client.mark_read_message(msg.id) if hasattr(msg,'content'): if msg._from != client.user_id: print(transColor(rjust(msg.content, screen_width,' '),lovers_color)) else: print(msg.content) else: try: sticker_id = msg.attachments[0][u'sticker'][u'sticker_id'] if msg._from != client.user_id: print(transColor(rjust(sticker_id, screen_width,' '),lovers_color)) else: print(sticker_id) except KeyError: pass print('==== System Message ====') print('If you want exit, type exit or quit') print('========================') t1 = threading.Thread(target=waitTyping, args=(client,)) bot = Bot(ID,PW, on_message=on_message) t2 = threading.Thread(target=bot.run_forever, args=(0.1,)) t1.start() t2.start() t1.join() bot.__del__()
from configuration import CONFIG from lib.bot import Bot bot = Bot( CONFIG["bot"]["number_of_users"], CONFIG["bot"]["max_posts_per_user"], CONFIG["bot"]["max_likes_per_user"], CONFIG["url"], ) users = bot.register_users() print("Added {} users!".format(len(users))) #print(users) posts = bot.create_posts() print("Added {} posts!".format(len(posts))) #print(posts) likes = bot.add_likes() print("Added {} likes!".format(len(likes))) #print(likes)
def __init__(self, ip, port, is_aggressive, max_bots): self.bots = [Bot(ip, port, is_aggressive) for _ in range(max_bots)] self.is_alive = True self.port = port self.ip = ip
from lib.bot import Bot from util.prompter import Prompter prompter = Prompter() bot = Bot(prompter) bot.start()