got python bot working

This commit is contained in:
Bryson Steck 2022-03-11 15:25:33 -07:00
parent 0b25b38e43
commit b3e1bd3a1d
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,7 @@
{
"follower_goal": "500,000",
"sub_goal": "1,000",
"write_file": "/path/to/file/you/want/to/write",
"username": "your_channel_name_goes_here",
"seconds_interval": 10
}

View file

@ -0,0 +1,25 @@
import requests
import time
import json
with open('settings.json') as f:
settings = json.load(f)
FOLLOWER_GOAL = settings['follower_goal']
SUB_GOAL = settings['sub_goal']
WRITE_FILE = settings['write_file']
USER = settings['username']
UPDATE = settings['seconds_interval']
print("Running!")
while(True):
followers = open(WRITE_FILE, 'w')
url_follows = "https://api.crunchprank.net/twitch/followcount/" + USER
read_follows = requests.get(url_follows)
url_subs = "https://decapi.me/twitch/subcount/" + USER
read_subs = requests.get(url_subs)
#if int(read_follows.text) > followerGoal:
# followerGoal += 50
print(f"Subs: {read_subs.text}/{SUB_GOAL}\nFollower goal: {read_follows.text}/{FOLLOWER_GOAL}\n", end='', file=followers)
followers.close()
time.sleep(UPDATE)