misskey-microblogger-demo/run.py
2024-11-09 13:20:08 +01:00

27 lines
678 B
Python

import typing
import random
import json
from src.Poster import Poster
from src.User.User import User
from src.Misskey import Misskey
def main():
with open("config.json", "r") as f:
config = json.load(f)
# Don't do ANYTHING this time if the roll against the global activity percentage failed
if (random.randint(0, 100) >= config["global"]["activity"]):
return False
for username in config["active_users"]:
user = User(username)
# Don't do anything for this user if they're not active right now
if (not user.is_online()):
continue
Poster(user.username, Misskey(config["server"]["url"], user.config["key"])).autorun()
if __name__ == "__main__":
main()