if ":!giveaway" in prevdata and senderusr in securelist and agive == 0:
agive = agive+1
message("Giveaway started by: " + senderusr)
time.sleep(3)
agive = 0
enteredgiveaway = enteredgiveaway.rstrip()
enteredgiveaway = enteredgiveaway.split(" ")
gg = random.choice(enteredgiveaway)
message("The winner of the giveaway is: " + gg)
gg = ""
enteredgiveaway = ""
if "PRIVMSG" in prevdata and agive == 1:
enteredgiveaway += senderusr + " "
The first if starts a giveaway and then after 3 seconds will select a random user that typed in the IRC and message the IRC saying whoever won.
However, my problem is that the second if is unable to collect users because the first command sleeps the program and the other if is unable to work.
How do I sleep but have the program be able to do to other stuff ?
(IRC Bot)
Entire Code : http://pastebin.com/Qr8hAH14
Let the first if clause set a
Timer, calling a method that does what you now do after sleeping.and in your quoted code segment:
This is a bit sketchy, as I can’t tell where, for example,
enteredgiveawayis coming from in your code sample. So, depending on the rest of your code, you might have to reorganize/restructure a bit to make it work. It’s probably better too to put everything in a class and use instance variables, if you haven’t done that already.