Added emoji-reaction based giveaway command
parent
95a669462f
commit
c753214317
|
@ -18,3 +18,4 @@
|
||||||
**!joke**: Posts a random joke from /r/Jokes
|
**!joke**: Posts a random joke from /r/Jokes
|
||||||
**!8ball**: You ask a question, it answeres. Simple!
|
**!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!
|
23
pocketbot.py
23
pocketbot.py
|
@ -177,6 +177,29 @@ def on_message(message):
|
||||||
else:
|
else:
|
||||||
yield from client.send_message(message.channel, 'The Magic Conch Shell says... ' + random.choice(ball_responses))
|
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.loop.create_task(ups_check())
|
||||||
client.run(token)
|
client.run(token)
|
Loading…
Reference in New Issue