import sys
from logs.logger import log
from utils import check_internet
import bot

if __name__ == "__main__":
    if check_internet() is True:
        try:
            log.info('Internet connection found')
            bot.run()
        except KeyboardInterrupt:
            # quit
            sys.exit()
        else:
            log.info('Please check your internet connection')
            sys.exit()
Exemple #2
0
    countdown,
    prob,
    MAIN_DB,
    PROBABILITIES,
    get_public_ip,
    check_internet,
    MAIN_DB_MIN_SIZE,
    get_seconds_to_wait,
    USE_SLEEP_SCHEDULE,
    reddit_bot_action,
    get_current_epoch,
    COMMENTS_DISABLED,
)

try:
    if not check_internet():
        log.error("internet check failed, do we have network?")
    ip = get_public_ip()
    log.info("My public IP address is: {}".format(ip))
except Exception as e:
    log.error("counld not check external ip")

RATE_LIMIT = 0
NEED_TO_WAIT = 0
log.info("------------new bot run--------------")
log.info("user is " + str(reddit.api.user.me(use_cache=True)))

reddit_bot = [
    reddit_bot_action("shadowcheck", reddit.shadow_check,
                      PROBABILITIES["SHADOWCHECK"], 0),
    reddit_bot_action("karmacheck", set_user_karma,