Added emoji-reaction based giveaway command

dev
pocketjawa 2017-03-19 02:47:09 -04:00
parent 95a669462f
commit c753214317
2 changed files with 25 additions and 1 deletions

View File

@ -17,4 +17,5 @@
**!kill** or **!restart**: Kill the bot process so that it can automatically restart with the new version (only pocketjawa can use these)
**!joke**: Posts a random joke from /r/Jokes
**!8ball**: You ask a question, it answeres. Simple!
**!conch** or **!magicconch**: Same as the 8ball command but waaaaay cooler
**!conch** or **!magicconch**: Same as the 8ball command but waaaaay cooler
**!giveaway prize**: Do a giveaway based on users reacting with the emoji you react with secretly. Use in private and replace prize with an actual prize!

View File

@ -177,6 +177,29 @@ def on_message(message):
else:
yield from client.send_message(message.channel, 'The Magic Conch Shell says... ' + random.choice(ball_responses))
#Create a message that will send the person who reacts correctly the contents of message. Use in either DMs or a channel the public cannot see.
elif message.content.lower().startswith('!giveaway'):
#Split off the text to send to the winner
args = message.content.partition(' ')[2]
if (args is ''):
yield from client.send_message(message.channel, 'Please include something to send to the winner!')
return
#Get the secret emoji
sourcemsg = yield from client.send_message(message.channel, 'React with the secret emoji :3')
sourceres = yield from client.wait_for_reaction(message=sourcemsg, timeout=30)
reactemoji = sourceres.reaction.emoji
#Send the poll to public
msg = yield from client.send_message(public_channel_id, 'React to this pls')
res = yield from client.wait_for_reaction(reactemoji, message=msg, timeout=30)
#Congratulate and ,essage the winner
yield from client.send_message(public_channel_id, 'Congrats to {0.user}!'.format(res))
yield from client.send_message(res.user, args)
client.loop.create_task(ups_check())
client.run(token)