To all of the entrants of the raffle one week ago- thank you for your entry! It's now time to announce the winners.
Congratulations to @mrehqe on winning the Polo and @robertdurst10 on winning the T-shirt!!! Please send me a message with your shipping details on steemit.chat or telegram, I'm robrigo in those chats as well.
Here's the proof:
I used the following code snippet below to pick winners at random from the comment replies. Feel free to adapt it for your own contests!
import re
import random
from steem import Steem
polo_regexp = re.compile(r'polo', flags=re.IGNORECASE)
tshirt_regexp = re.compile(r'tshirt|t\-shirt|shirt',flags=re.IGNORECASE)
BLACKLIST = ['matt-a']
s = Steem()
raffle_replies = s.get_content_replies('robrigo', 'giveaway-bitshares-polo-and-t-shirt-up-for-grabs-to-celebrate-smashing-bugs')
random.shuffle(raffle_replies)
entrants = {
'polo': [],
'tshirt': []
}
for reply in raffle_replies:
if (reply['author'] in BLACKLIST
or reply['author'] in entrants['polo']
or reply['author'] in entrants['tshirt']):
continue
elif polo_regexp.search(reply['body']):
entrants['polo'].append(reply['author'])
elif tshirt_regexp.search(reply['body']):
entrants['tshirt'].append(reply['author'])
print("""
Congratulations %s! You win the polo.
Congratulations %s! You win the tshirt.
""" % (random.choice(entrants['polo']), random.choice(entrants['tshirt'])))