ref: b717d027b8f6705d6b6eb11dd6ea2ecd0c1cb980
parent: e9c239a3e0c40963003327907c55a03c3ba040d5
author: 0x4A4D00 <scorpion_rn@yahoo.com>
date: Mon Jul 24 17:53:09 EDT 2023
Full Async Working
--- a/.idea/Test-IRC.iml
+++ b/.idea/Test-IRC.iml
@@ -16,7 +16,6 @@
<orderEntry type="library" scope="PROVIDED" name="async-http (v0.60.2, ruby-3.2.1-p31) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="async-io (v1.35.0, ruby-3.2.1-p31) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="async-pool (v0.4.0, ruby-3.2.1-p31) [gem]" level="application" />
- <orderEntry type="library" scope="PROVIDED" name="cinch (v2.3.4, ruby-3.2.1-p31) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="console (v1.17.4, ruby-3.2.1-p31) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="fiber-annotation (v0.2.0, ruby-3.2.1-p31) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="fiber-local (v1.0.0, ruby-3.2.1-p31) [gem]" level="application" />
--- a/test.rb
+++ b/test.rb
@@ -151,7 +151,7 @@
result = json_obj['token']['text']
if result == '<|endoftext|>' then
break
- elsif counts >= 20
+ elsif counts >= 50
begin
$bot.send_message(peer, 'limit reached!')
break
@@ -159,6 +159,7 @@
elsif result.include?("\n")
begin
$bot.send_message(peer, b)
+ sleep(0.2)
counts += 1
#$irc.msg(peer, b)
b = ''
@@ -194,13 +195,13 @@
if event.channel.eql?(BotNick)
begin
if (event.message.start_with?(".invite"))
- begin
+ begin
event.message.slice! ".invite "
$bot.add_channel(event.message)
- end
+ end
else
$bot.send_message(event.from, "I'm thinking...")
- sender.async.SendReq(event.from, event.message, '')
+ sender.SendReq(event.from, event.message, '')
end
end
else
@@ -209,7 +210,7 @@
Send()
# IRCConnection.output_push("PRIVMSG #{event.channel} : moz")
$bot.send_message(event.channel, "#{event.from}, I'm thinking...")
- sender.async.SendReq(event.channel, event.message, '')
+ sender.SendReq(event.channel, event.message, '')
end
end