guys i write a chat bot for twitch in hobby. i want to spam a word in chat in a time like that write to chat"hello" and wait 10 sec then write again i did that but in my code have a answer system like that when anyone write to chat !hey my bot answering hello to him. and when i tried in same system that not working
until @socket.eof? do
message = @socket.gets
puts message
if message.match(/PRIVMSG ##{@channel} :(.*)$/)
a = Time.now
b = Time.now + 5
while a < b do
write_to_chat("!prime")
a += 4
sleep(20)
end
end
if message.match(/PRIVMSG ##{@channel} :(.*)$/)
content = $~[1]
username = message.match(/@(.*).tmi.twitch.tv/)[1]
if content.include? 'theoSea'
write_to_chat(" theoAse theoAse theoAse")
end
i solved it with scheduler i wanted a code for write every 5 min i tried lots of method but sleep command and i found this link "https://github.com/jmettraux/rufus-scheduler" all in link u can use this gem. thx for everything guys.