ref: 06f3e2952573fc39657726c6d84e5e3b33939abc
parent: 391dd56eacb294363687cb73b80c9d8ef6dc650d
author: 0x4A4D00 <scorpion_rn@yahoo.com>
date: Tue Jul 18 19:38:36 EDT 2023
Multi Threading Updated - Not Working Yet
--- a/test.rb
+++ b/test.rb
@@ -76,17 +76,52 @@
end
-$irc.heard_msg(:if => {:pm? => true}) do |e|
- SendReq(e.nick, e.message, $irc)
+def Tra
+ $irc.heard_msg(:if => {:pm? => true}) do |e|
+ SendReq(e.nick, e.message, $irc)
+ end
+
+ $irc.heard_msg(:if => {:pm? => false}) do |e|
+ if (e.message.start_with?("h2o"))
+ SendReq(e.channel, e.message, $irc)
+ end
+ end
end
-$irc.heard_msg(:if => {:pm? => false}) do |e|
- if (e.message.start_with?("h2o"))
- SendReq(e.channel, e.message, $irc)
+def Tra2
+ $irc.heard_msg(:if => {:pm? => true}) do |e|
+ SendReq(e.nick, e.message, $irc)
end
+
+ $irc.heard_msg(:if => {:pm? => false}) do |e|
+ if (e.message.start_with?("h2o"))
+ SendReq(e.channel, e.message, $irc)
+ end
+ end
end
+def Tra3
+ $irc.heard_msg(:if => {:pm? => true}) do |e|
+ SendReq(e.nick, e.message, $irc)
+ end
+ $irc.heard_msg(:if => {:pm? => false}) do |e|
+ if (e.message.start_with?("h2o"))
+ SendReq(e.channel, e.message, $irc)
+ end
+ end
+end
+
+threads = []
+threads << Thread.new { Tra() }
+threads << Thread.new { Tra2() }
+threads << Thread.new { Tra3() }
+
+# Wait for all threads to complete
+threads.each(&:join)
+
+
+
# $irc.heard_msg() do |e|
#
#
@@ -94,15 +129,17 @@
# end
$irc.start_listening!
-#
-# def Tra
-#
-# end
-#
-# threads = []
-# threads << Thread.new { Tra() }
-# threads << Thread.new { Tra() }
-# threads << Thread.new { Tra() }
-#
-# # Wait for all threads to complete
-# threads.each(&:join)
+
+
+
+$irc.heard_msg(:if => {:pm? => true}) do |e|
+ SendReq(e.nick, e.message, $irc)
+end
+
+$irc.heard_msg(:if => {:pm? => false}) do |e|
+ if (e.message.start_with?("h2o"))
+ SendReq(e.channel, e.message, $irc)
+ end
+end
+
+