Skip to content

Instantly share code, notes, and snippets.

@moeenio
Created May 18, 2020 07:41
Show Gist options
  • Save moeenio/d288c61e542c51f40337eafb56cf4d10 to your computer and use it in GitHub Desktop.
Save moeenio/d288c61e542c51f40337eafb56cf4d10 to your computer and use it in GitHub Desktop.
Scratch Messages Count for BitBar

Shows a count of messages from Scratch accounts in your macOS menu bar with BitBar.

Set the usernames in the usernames list.
The first will be shown directly in the menu bar, while the others will show in the dropdown.

This script requires python 3 and requests, install it via pip.

#!/usr/bin/env PYTHONIOENCODING=UTF-8 /usr/local/bin/python3
import requests
usernames = ["Locness", "Lecnoss", "griffpatch", "Yllie"]
print(requests.get(("https://api.scratch.mit.edu/users/%s/messages/count" % usernames[0])).json()["count"])
print("---")
for username in usernames:
count = requests.get(("https://api.scratch.mit.edu/users/%s/messages/count" % username)).json()["count"]
print("%s : %i" % (username, count))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment