Last active
April 23, 2017 01:30
-
-
Save gnilchee/d95de748335e9c9fb89e19d05fb589ae to your computer and use it in GitHub Desktop.
Making sure John Smith Enjoys Cage quotes in Channel
This file contains 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
from slackclient import SlackClient | |
from configparser import ConfigParser | |
import random, time | |
# Pulling in API Token | |
config = ConfigParser() | |
config.read('slack.conf') | |
SLACK_TOKEN = config['slack']['SLACK_API_TOKEN'] | |
# channel: A3X4APECJ | |
# John Smith = username: jsmith, id: U0V2D050M | |
sc = SlackClient(SLACK_TOKEN) | |
# Nicolas Cage quotes to randomly choose | |
quotes_of_nc = ["That's funny, my name's Roger. Two Rogers don't make a right!", "Well, I'm one of those fortunate people who like my job, sir. Got my first chemistry set when I was seven, blew my eyebrows off, we never saw the cat again, been into it ever since.", "Put... the bunny... back... in the box.", "Sorry boss, but there's only two men I trust. One of them's me. The other's not you.", "Hey! My mama lives in a trailer!", "Tool up, honey bunny. It's time to get bad guys.", "Release the baby!", "I mean it, honey, the world is being Fed-exed to hell in a hand cart.", "I'll be taking these Huggies and whatever cash ya got.", "People don't throw things at me any more. Maybe because I carry a bow around.", "After the Cold War, the AK-47 became Russia's biggest export. After that came vodka, caviar, and suicidal novelists.", "You'll be seeing a lot of changes around here. Papa's got a brand new bag.", "It's like we're on two different channels now. I'm CNN and she's the Home Shopping Network.", "Every great story seems to begin with a snake.", "Look, I happen to still like really dark, dramatic, fractured characters."] | |
try: | |
while True: | |
time.sleep(60) | |
# Get members of channel in list | |
members_of_nc = sc.api_call("channels.info", channel="A3X4APECJ")['channel']['members'] | |
if 'U0V2D050M' not in members_of_nc: | |
# Add jsmith to channel | |
sc.api_call("channels.invite", channel="A3X4APECJ", user="U0V2D050M") | |
# Post a random cage quote you know jsmith will love! | |
sc.api_call("chat.postMessage", channel="A3X4APECJ", text="@jsmith: '{}' - Nicolas Cage (prolific actor)".format(random.choice(quotes_of_nc)), as_user=True) | |
except KeyboardInterrupt: | |
print("Trolling is a full time responsibility. Good work today!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment