Skip to content

Instantly share code, notes, and snippets.

@singlerider
Created May 9, 2015 16:46
Show Gist options
  • Save singlerider/ec47d9c6cc9979f5cf65 to your computer and use it in GitHub Desktop.
Save singlerider/ec47d9c6cc9979f5cf65 to your computer and use it in GitHub Desktop.
"""
Developed Shane Engelman <me@5h4n3.com>
"""
# IN ORDER FOR THIS TO RUN CORRECTLY
# run '!shots init 0' the first time
import globals
import pickle
from src.lib.twitch import *
def writeSmack():
pickle.dump(times_smacked, open("smack.pkl", "wb"))
def readSmack():
try:
return pickle.load(open("smack.pkl", "rb"))
except:
return 0
times_smacked = readSmack()
usage = "!shots (add/remove/set [amount])"
def smack(args):
username = args[0].lower()
__ , all_users = get_dict_for_users()
#return readSmack()
if username in all_users:
if username != globals.CURRENT_USER:
global smacked_user
#my_dict.update((x, y*2) for x, y in my_dict.items())
smacked_user = {'times_smacked': 1}
print smacked_user
smacked_user[username]['times_smacked'] = times_smacked += 1
print smacked_user
writeSmack()
return "{} has been smacked {} times!".format(smacked_user[username], smacked_user[username]['times_smacked'])
else:
return "You can't smack yourself. What good would that do?"
else:
return "You can't smack someone that isn't in the same chat as you!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment