Code:
while True:
data = irc.recv(4096)
if data.find('PING') != -1:
irc.send('PONG '+ data.split() [1] +' \r\n')
if data.find('!latest') != -1:
irc.send('PRIVMSG #PwnMyI :\x02Latest Article:\x02 %s, \x02written by\x02 %s \r\n' % (art_name, art_auth))
irc.send('PRIVMSG #PwnMyI :\x02Description:\x02 %s \r\n' % art_desc)
irc.send('PRIVMSG #PwnMyI :\x02View Article:\x02 %s \r\n' % art_link)
This is a snippet of code from my bot. The rest of the code is custom build, and split into different files, and you don't need them anyway.
irc
is the socket connection, and send
sends the data over the socket. What I want to do is implement a timing feature, so that it'll only work once every 5 minutes. Just to stop abuse. Can anyone point me in the right direction? thanks.
Create a last sent timestamp variable. When you post, check to see if the last sent timestamp is within a certain time period. If it is, don't post. If it isn't, post and update it with the current time.