Created
July 13, 2015 14:08
-
-
Save Kubo2/3a98c560adabd286eb98 to your computer and use it in GitHub Desktop.
Adds a WelcomeBot master privilege to StackExchange chatroom user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import shelve | |
host_id = "stackoverflow.com" | |
room_id = "22091" | |
if len(sys.argv) == 1: | |
print(""" | |
usage: %s <user-id> | |
""" % (sys.argv[0],)) | |
exit(1) | |
user_to_priv = sys.argv[1] | |
priv_users = shelve.open("privileged_users.txt") | |
if (host_id + room_id) not in priv_users: | |
priv_users[host_id + room_id] = [] | |
if user_to_priv in priv_users[host_id + room_id]: | |
print("User already privileged") | |
exit(0) | |
else: | |
priv_users[host_id + room_id] += [user_to_priv] | |
print("User " + user_to_priv + " added to privileged users for room " + room_id + " on chat." + host_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment