Esempio n. 1
0
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): ")
Esempio n. 2
0
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()
Esempio n. 3
0
	def print_board(player_state, game_state, show_hand=True):
		if len(Game.get_creatures(game_state)):
			Card.print_hand(Game.get_creatures(game_state), owner=Game.get_player_states(game_state).index(player_state))
		if len(Game.get_lands(game_state)):
			Card.print_hand(Game.get_lands(game_state), owner=Game.get_player_states(game_state).index(player_state))
		Card.print_hand(Bot.hand(player_state), show_hand=show_hand)
		print("\n                         {} life - {} - Mana Pool: {}".format(Bot.hit_points(player_state), Bot.display_name(0), Bot.temp_mana(player_state)))
Esempio n. 4
0
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 
Esempio n. 5
0
    def __init__(self):
        Bot.__init__(self, '1m')

        user_id = os.environ.get("GMAIL_ADDRESS")
        if user_id is None:
            raise Exception("Please set GMAIL_ADDRESS into env to use Trading View Strategy.")
        self.subscriber = GmailSub(user_id)
        self.subscriber.set_from_address('*****@*****.**')
    def __init__(self):
        Bot.__init__(self, ['5m', '15m', '4h'])

        self.ohlcv = {}

        for i in self.bin_size:
            self.ohlcv[i] = open(f"ohlcv_{i}.csv", "w")
            self.ohlcv[i].write("time,open,high,low,close,volume\n") #header
Esempio n. 7
0
    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")
Esempio n. 8
0
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)
Esempio n. 9
0
    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))
Esempio n. 10
0
def main():

    logger.info("Initializing...")

    try:
        Bot("config.ini").run()
    except:
        logger.error("A global error occured.")
Esempio n. 11
0
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)
Esempio n. 12
0
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)
Esempio n. 13
0
def main(bot):

    NUM = bot.queue
    LEN_NUM = len(NUM)

    logger.debug('all pair_urls: {}'.format(LEN_NUM))

    try:
        for i, _id in enumerate(NUM):
            if all([i % BOT_LIVES == 0, i != 0]):
                logger.debug(bot)
                bot.turn_off_bot()
                logger.debug('DIE BOT')
                bot = Bot.new_bot()
                logger.debug('NEW {}'.format(bot))

            bot_soups = new_bot_soups(bot, _id)
            data_to_db = union_parse_pages(*bot_soups)
            data_to_db.update({'myscore_id': _id})
            append_data_to_file(bot.crawled_file, _id)

            logger.info('crawl_url: \n{}, \n{}'.format(*url_mask(_id)))
            logger.info('complite on: {} %'.format((i + 1) / LEN_NUM * 100))

            # write data to db
            db = get_db()
            insert_to_football_db(db, data_to_db)
            logger.info('data write to db')
        bot.turn_off_bot()

    except AttributeError as e:

        logger.exception(e)
        logger.info('error match_id:', _id)
        create_restore_file(
            path_queue_file=bot.queue_file,
            path_crawled_file=bot.crawled_file,
            path_restore_file=bot.restore_file
        )
        restore_main(bot)

    finally:

        create_restore_file(
            path_queue_file=bot.queue_file,
            path_crawled_file=bot.crawled_file,
            path_restore_file=bot.restore_file
        )
Esempio n. 14
0
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
Esempio n. 15
0
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
Esempio n. 16
0
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"]:
Esempio n. 17
0
import os



# lets get all our details like the bot token
# the token
from config import *

from src.bot import Bot
from src.tweeter import Twitter



myBot = Bot(SLACK_TOKEN_ID, bot_user="******")

twitter = Twitter(consumer_key=CONSUMER_KEY, consumer_secret=CONSUMER_SECRET,
                  access_token=ACCESS_TOKEN, access_token_secret=ACCESS_TOKEN_SECRET)
twitter.auth()

myBot.registerListener(twitter.listenForMsg,'message')

twitter.registerListener(myBot.listenForMsg, 'tweet')

if __name__ == "__main__":
    myBot.run()