def main(): print("Welcome to Autoclicker v.1") train_or_deploy = input("What are we doing today? (train) (deploy): ") # Split form train or deploy option if train_or_deploy == "train": # Initializing Variables file_name_train = input("File name: ") number_of_clicks = input( "Number of clicks (type -1 for continuous clicking): ") # If statement for number of clicks print("Begin clicking! (Scroll the mouse-wheel when complete)") mouse_train = MouseInput(file_name_train, number_of_clicks) print("Stopped") elif train_or_deploy == "deploy" or "2": file_name_deploy = input("Please input file name (add .json please): ") number_of_loops = int( input("Number of loops (type -1 for infinite loop): ")) print( f"Using {file_name_deploy} as file input with {number_of_loops} number of loops." ) print("Beginning clicking.") mouse_clicker = Bot(file_name_deploy, number_of_loops) mouse_clicker.loop() print(f"Finished {number_of_loops} loops") else: print("Please select option (train or 1) (deploy or 2): ")
def main(): args = parse_args() proxy = setup_proxy(args.proxy_url, args.proxy_auth) if not args.QR_text == "": args.file = "./img/QRcode.png" Image.create_QR_image(args.QR_text, args.QR_scale) image = Image(args.file, args.round_sensitive, args.image_brightness) bot = Bot(image, args.fingerprint, args.start_x, args.start_y, args.mode_defensive, args.colors_ignored, args.colors_not_overwrite, args.min_range, args.max_range, proxy, args.draw_strategy, args.xreversed, args.yreversed) bot.init() def run(): try: bot.run() except NeedUserInteraction as exception: alert(str(exception)) try: if raw_input(I18n.get('token_resolved')).strip() == 'y': run() except NameError as e: if input(I18n.get('token_resolved')).strip() == 'y': run() run()
async def start(): USERNAME = os.getenv("FB_USERNAME") PASSWORD = os.getenv("FB_PASS") if not USERNAME or not PASSWORD: raise Exception("Username / password not supplied") sessionCookiePath = "config/session_cookies.pickle" sessionCookie = None if os.path.exists(sessionCookiePath): with open(sessionCookiePath, 'rb') as cookie: sessionCookie = pickle.load(cookie) print(f'Logging into {USERNAME}...') bot = Bot() await bot.start(USERNAME, PASSWORD, session_cookies=sessionCookie) if sessionCookie is not None: print("Using session cookies to log in") else: print("Saved session cookies") session = client.getSession() with open(sessionCookiePath, 'wb') as cookie: pickle.dump(session, cookie) print("Logged in!") bot.listen()
def main(): TIME = 60 * 60 # 60 min * 60s --> s # getting twitter keys CONSUMER_KEY = environ['CONSUMER_KEY'] CONSUMER_SECRET = environ['CONSUMER_SECRET'] ACCESS_TOKEN = environ['ACCESS_KEY'] ACCESS_TOKEN_SECRET = environ['ACCESS_SECRET'] # init bot bot = Bot(CONSUMER_KEY=CONSUMER_KEY, CONSUMER_SECRET=CONSUMER_SECRET, ACCESS_TOKEN=ACCESS_TOKEN, ACCESS_TOKEN_SECRET=ACCESS_TOKEN_SECRET) # init tracker (database api call) tracker = Tracker() # tweet init tweet = Tweet(totalDeaths=(tracker.getTotalDeaths()), totalInfected=(tracker.getTotalInfected())) while True: # Get latest data from Tracker tracker.update() # Generate tweet with latest data tweet.update(totalDeaths=(tracker.totalDeaths), totalInfected=(tracker.totalInfected)) # Get old tweets oldTweets = bot.getOldTweets() # Check if tweet is not duplicated if (tweet.isDuplicated(oldTweets=oldTweets) == False): bot.postTweet(text=(tweet.text)) time.sleep(TIME) #s
def create(self, tauntPath: str): """ :param tauntPath: The folder in which all the tauntpacks are located :return Bot: """ if(os.path.isdir(tauntPath) == False): raise Exception("Path for taunts does not exist") bot = Bot() dirs = next(os.walk(tauntPath))[1] for i in dirs: path = os.path.join(tauntPath, i) if(os.path.isfile(path + "/config.yml") == False): log.error("{dir} does not have a config.yml, skipping...". format(dir=i)) continue try: tauntPack = TauntPackFactory().create(path) bot.tauntPacks.append(tauntPack) log.info("Loaded tauntpack {name}".format(name=tauntPack.name)) except Exception as e: log.error('failed to load tauntpack', exec_info=True) return bot
def main(): logger.info("Initializing...") try: Bot("config.ini").run() except: logger.error("A global error occured.")
def __init__(self) -> None: # basic init for pygame: window/screen, blackground, clock and fonts # fonts need to be initialized extra pygame.init() pygame.font.init() pygame.display.set_caption(GAME_NAME) self.window = pygame.display.set_mode( (WINDOW_SIZE_X + TERMINAL_WIDTH, WINDOW_SIZE_Y)) self.background = pygame.Surface( (TILE_HEIGHT * ROWS, TILE_WIDTH * COLS)) self.clock = pygame.time.Clock() self.terminal_font = pygame.font.SysFont(FONT_TYPE, TERMINAL_FONT_SIZE) self.description_font = pygame.font.SysFont(FONT_TYPE, DESCRIPTION_FONT_SIZE) self.game_over_font = pygame.font.SysFont(FONT_TYPE, GAME_OVER_FONT_SIZE) # init chessboard # an array of meeples is created that reflects the default setup # sprites are loaded from board list which are then added to the sprite group, because it is easier to draw them self.board = Chessboard() self.sprites = self.board.loadSprites() self.chess_sprite_list = pygame.sprite.Group() self.chess_sprite_list.add(self.sprites) # tile representation of the chessboard # used to determine tile/meeple on click events self.chessboard_tiles = self.board.loadTiles(self.background) # init terminal # clickable button without UX -> no highlighting are click reaction # terminal window that logs the moves performed by the players # notations for each player are saved to different arrays; if notations exceed 28 lines -> list.pop is used / no scrolling possible # instance variables for a white meeple that a player has selected and the possbile moves for the according meeple self.terminal = Terminal(self.terminal_font) # init black player self.bot = Bot() # draw terminal on the right side of the game window including a "new game" button drawTerminal(self) # conditions for the game loop self.gameRunning = True # condition for gameloop self.playerTurn = True # white starts playing self.selectedField = False # player has selected a field self.check_white = False self.check_black = False self.draw = False self.check_mate_white = False self.check_mate_black = False # init first possible moves for white player # saves the next possibles for each side self.number_of_moves = self.board.getAllMoves("w")
def main(): args = parse_args() proxy = setup_proxy(args.proxy_url, args.proxy_auth) image = Image(args.file) bot = Bot(image, args.fingerprint, args.start_x, args.start_y, args.mode_defensive, args.colors_ignored, proxy, args.draw_strategy) bot.run()
def run(start, restore, url, progect_name): # bot = Bot(START_URL, PROJECT_NAME) bot = Bot(url, progect_name) if start == 'yes' and restore == 'no': create_match_ids_list(bot) # bot.queue '\/' append_list_to_file(bot.queue_file, bot.queue) # write ids to file main(bot) elif restore == 'yes' and start == 'no': restore_main(bot)
def entry(): try: if request.args.get(SALAM_BOT_TOKEN_KEY) != SALAM_BOT_TOKEN_VALUE: raise Exception('BAD_TOKEN') bot = Bot(json.loads(request.get_data())) bot.run() return jsonify({'success': 'true'}) except Exception as e: logging.error(e, exc_info=True) abort(404)
def main(): config_path = './config.yaml' config = yaml.load(open(config_path, 'r')) logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', filename=datetime.now().strftime('%H_%M_%d_%m_%Y.log'), filemode='w', # для каждого запуска создает свой log файл level=logging.INFO) logger = logging.getLogger(__name__) connector = SshConnector(config['host'], config['port'], config['username'], config['password'], logger) # running bot Bot(connector, logger, config)
def run(self): while self.current_loops < self.n_loops: script_list = ("weeds_clean2", "east_bank1" ) # scripts to run # + Randomizer(1, 8, 1).select() <====#==== randomizer(min,max,step) for index, current_script in enumerate(script_list): # print(index, current_script) bot = Bot(current_script) bot.loop() self.current_loops += 1 print("loop number: " + str(self.current_loops))
def setUpModule(): os.system("mysql -uroot -e \"CREATE DATABASE lorenzotest\"") globals.mysql_credentials = ['localhost', 'root', '', 'lorenzotest'] print globals.mysql_credentials print "\"CREATE DATABASE lorenzotest" os.system('mysql -uroot lorenzotest < schema.sql') import src.lib.queries.connection as connection connection.initialize() global server, client server = TwitchIrc() client = Bot() threading.Thread(target=client.run).start() server.get_output() # User server.get_output() # Pass server.get_output() # Nick server.get_output() # Join
def main(): args = parse_args() proxy = setup_proxy(args.proxy_url, args.proxy_auth) image = Image(args.file, args.round_sensitive, args.image_brightness) bot = Bot(image, args.fingerprint, args.start_x, args.start_y, args.mode_defensive, args.colors_ignored, proxy, args.draw_strategy) bot.init() def run(): try: bot.run() except NeedUserInteraction as exception: alert(exception.message) if raw_input(I18n.get('token_resolved')) == 'y': run() run()
def main(): cfg = Settings('settings/settings_private.cfg').get_config() b = Bot(cfg) iteration = 1 while True: # read config every iteration from disk so that we can change parameters without restart cfg = Settings('settings/settings_private.cfg').get_config() logging.debug('\n\nStarting iteration %s\n', iteration) run_iteration(b, cfg, iteration) wait_time = random.randint(int(cfg.cycle_wait_time * 0.8), cfg.cycle_wait_time) logging.debug('waiting %s seconds...', wait_time) time.sleep(wait_time) iteration += 1
def init(config): jodelaccount = config["jodel"]["account"] location = config["location"] account = JodelApi(lat=location["lat"], lng=location["lng"], city=location["city"], config=config, update_location=True, access_token=jodelaccount["access_token"], device_uid=jodelaccount["device_uid"], expiration_date=jodelaccount["expiration_date"], distinct_id=jodelaccount["distinct_id"], refresh_token=jodelaccount["refresh_token"], is_legacy=jodelaccount["is_legacy"]) Bot(account, config["mensas"][0], api.MensaApi(config["mensas"][0]["id"]), config["templates"]).start() '''for mensa in config["mensas"]:
#!/usr/bin/env python2.7 from src.bot import Bot if __name__ == '__main__': Bot()
chat = chats.chats[0] printChannel(chat) inputChannel = InputChannel(chat.id, chat.access_hash) request = GetParticipantsRequest(inputChannel, ChannelParticipantsRecent(), 0, 5) # result = client(request) result = '' printParticipants(result) if __name__ == '__main__': logging.basicConfig( format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO) settings = load() # Connect to our database. dal.database.connect() # Create the tables. dal.database.create_tables( [dal.User, dal.Channel, dal.Mapping, dal.Status], safe=True) bot = Bot(settings) # Run the bot until you press Ctrl-C or the process receives SIGINT, # SIGTERM or SIGABRT. This should be used most of the time, since # start_polling() is non-blocking and will stop the bot gracefully. bot.updater.idle()
from src.bot import Bot bot = Bot(version="0.1", prefix="+", owner_ids=[322063964219637771, 455321156224942091])
#!/usr/bin/env python3 import sys import traceback import redis from src.bot import Bot from src.utils import fprint from src.const import BOT, TOKEN, REDIS_URL, DEFAULT_COGS db = redis.from_url(REDIS_URL) bot = Bot(db) if __name__ == "__main__": for cog in DEFAULT_COGS: try: bot.load_extension("src.cogs." + cog) except Exception: fprint(f"Failed to load cogs ({cog})", file=sys.stderr) traceback.print_exc() bot.run(TOKEN, bot=BOT, reconnect=True)
import sys import traceback #pysrc_folder = os.getenv('BOT_DIR') + "/" + os.getenv('BOT_NAME') + "/AI/pysrc" #sys.path.append(pysrc_folder) #import pydevd #pydevd.settrace('172.17.0.1', stdoutToServer=True, stderrToServer=True, suspend=False) sys.path.append("C:/Users/solevi/PycharmProjects/PJBot/AI/bwmirror_v2_5.jar") # site-packages folder sys.path.append("./Lib/site-packages") print sys.path try: from src.bot import Bot # Calls mirror.start which blocks until the end of the game Bot().run() except Exception as e: print e traceback.print_exc()
def setUp(self): self.slack_client = Mock() self.bot = Bot(self.slack_client, user_id="my_user_id")
import json from src.bot import Bot import os config = json.load(open(os.path.abspath("./config.json"))) bot = Bot(config) bot.run()
def test_1_initiliaze_bot(self): bot = Bot('name', 'oauth', 'channel') bot.socket.close() # silences unclosed socket warning self.assertTrue(bot)
from src.parser.oauthparser import OauthParser from src.bot import Bot import sentry_sdk from sentry_sdk.integrations.logging import LoggingIntegration from src.logging import Logging from src.actions.actionresolver import ActionResolver from src.responsehandler import ResponseFilter from src.celery.tasks import vector_say if __name__ == "__main__": # setup logging Logging() # setup db db = DB('./vector.db') # get env settings twitchenv = TwitchEnvironment() # prepare oauth oauthParser = OauthParser() oauth = Oauth(db, twitchenv, oauthParser) actions = ActionResolver() response_filter = ResponseFilter(actions, oauth) # run the bot bot = Bot(oauth, twitchenv, response_filter) bot.run()
def bot(): return Bot(twitter_client=MagicMock(), broker=MagicMock())
from flask import Flask, request from src.bot import Bot from src.sentiment import SentimentAnalyzer app = Flask(__name__) bot = Bot() @app.route('/', methods=['POST']) def hello_world(): input = list(request.form)[0] return bot.get_response(input) if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=True)
def __run_bot(event, data=()): bot = Bot({ 'event': event, 'data': data, }) bot.run()
def __init__(self): self.bot = Bot()
def main(): aria2_config = toolkits.config_reader(initial_args().config) config_validator(aria2_config) telegram_bot = Bot(aria2_config) telegram_bot.start()