needabot 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c5b3a705e1956b25e561ea5ea11f408419dd2877de5dcf1295b69e5e23eab64b
4
+ data.tar.gz: 83f29430c0a70a78a5e15ba5e1c35ca1e1fe4fe70c82153b773847dd7d2c2227
5
+ SHA512:
6
+ metadata.gz: b0f53d7e9d336cf90b47682ff92cd9ffb0e8d84d8dcb52bf1087c79922131e2724bdfb61db0f5f77170a48fcba1c1f31e160157431b3c51d2d6e45abcf4d61dc
7
+ data.tar.gz: 6c7b59ba3dede5999a3a40a447d3b4cb30e41faefb60f5893fa4dd9c1588d39cc12609ef7ce748d62561fd9c18e83572e3784539d81b5d480462563b724defd6
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-04-14
4
+
5
+ - Initial release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Erik Olson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Needabot
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/needabot`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ ```bash
14
+ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
+ ```
16
+
17
+ If bundler is not being used to manage dependencies, install the gem by executing:
18
+
19
+ ```bash
20
+ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/needabot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/needabot/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the Needabot project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/needabot/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Needabot
4
+ VERSION = "0.1.0"
5
+ end
data/lib/needabot.rb ADDED
@@ -0,0 +1,309 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'zircon'
4
+ require_relative "needabot/version"
5
+
6
+ module Needabot
7
+
8
+ if !ENV.has_key? "IRC"
9
+ puts "set IRC with 'export IRC=nickname@host:port#channel';"
10
+ exit 0
11
+ end
12
+
13
+ URI,c = ENV['IRC'].split('#')
14
+ CHANNEL = "##{c}"
15
+ ACCT,PORT = URI.split(':')
16
+ NICK,HOST = ACCT.split('@')
17
+
18
+ puts %[NeedABot: #{NICK}@#{HOST}:#{PORT}#{CHANNEL}]
19
+
20
+ class Error < StandardError; end
21
+ @@C = Zircon.new(
22
+ :server => HOST,
23
+ :port => "#{PORT}",
24
+ :channel => CHANNEL,
25
+ :username => NICK
26
+ )
27
+
28
+ def self.msg h={}
29
+ h.each_pair { |k,v| if "#{v}".length > 0; puts %[========> #{k} #{v}]; @@C.privmsg(k,%[:#{v}]); end }
30
+ end
31
+
32
+ @@FACE = {}
33
+ def self.face
34
+ @@FACE
35
+ end
36
+
37
+ @@ON = {}
38
+ def self.on k, h={}, &b
39
+ if block_given?
40
+ @@ON[k] = b
41
+ else
42
+ puts %[ON: #{k} => #{h}]
43
+ @@ON[k].call(h)
44
+ end
45
+ end
46
+
47
+ @@CHAN = {}
48
+ def self.chan
49
+ @@CHAN
50
+ end
51
+ def self.chan? i, h={}
52
+ r = []
53
+ @@CHAN.each_pair { |kk,vv| if m = Regexp.new(kk).match(i); r << vv.call(m, h); end }
54
+ return r.flatten.compact
55
+ end
56
+ @@PRIV = {}
57
+ def self.priv
58
+ @@PRIV
59
+ end
60
+ def self.priv? i, h={}
61
+ r = []
62
+ @@PRIV.each_pair { |kk,vv| if m = Regexp.new(kk).match(i); r << vv.call(m, h); end }
63
+ return r.flatten.compact
64
+ end
65
+ @@C.on_message { |m|
66
+ #puts %[##### #{m}]
67
+ }
68
+
69
+ @@C.on_message do |message|
70
+ #puts %[-----------> #{message.from} #{message.to} #{message.type} #{message.body}]
71
+ h = { from: message.from, to: message.to, type: message.type }
72
+ if CHANNEL == message.to
73
+ Needabot.chan?(message.body, h).each { |e| Needabot.msg(Needabot.on(:chan, h.merge!({ input: e }))) }
74
+ elsif NICK == message.to
75
+ Needabot.priv?(message.body, h).each { |e| Needabot.msg(Needabot.on(:priv, h.merge!({ input: e }))) }
76
+ end
77
+ end
78
+
79
+ def self.run
80
+ begin
81
+ @@C.run!
82
+ rescue => err
83
+ puts %[Err: #{err}]
84
+ end
85
+ end
86
+ def self.run!
87
+ fork { Needabot.run }
88
+ end
89
+ end
90
+
91
+ module ME
92
+ # abilities (defines user abilities)
93
+ @@CAN = Hash.new { |h,k| h[k] = lambda { |*a| puts %[==< I >< #{k} >\n#{a}] } }
94
+ def self.can
95
+ @@CAN
96
+ end
97
+
98
+ # user abilities
99
+ @@ME = {}
100
+ class Me
101
+ attr_accessor :can
102
+ def initialize k
103
+ @id = k
104
+ @can = Hash.new { |h,kk| h[kk] = lambda { |*a| puts %[==< #{kk} >< #{k} >\n#{a}] } }
105
+ end
106
+ def [] k
107
+ if ME.can.has_key?(k)
108
+ if @can.has_key?
109
+ @can[k]
110
+ else
111
+ ME.can[k]
112
+ end
113
+ end
114
+ end
115
+ end
116
+ def self.us
117
+ @@ME.keys
118
+ end
119
+ def self.[] k
120
+ @@ME[k]
121
+ end
122
+
123
+ # chan abilities
124
+ class We
125
+ attr_accessor :will
126
+ def initialize
127
+ @will = Hash.new { |h,k| h[k] = lambda { |*a| puts %[==< WE >< #{k} >\n#{a}] } }
128
+ end
129
+ end
130
+ @@WE = We.new
131
+ def self.we
132
+ @@WE
133
+ end
134
+
135
+ @@T = {
136
+ ":" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[OUR #{args}] } },
137
+ "!" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[DO #{args}] } },
138
+ "@" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[AT #{args}] } }
139
+ }
140
+ def self.triggers
141
+ @@T
142
+ end
143
+
144
+ @@U = {
145
+ ":" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[OUR #{args}] } },
146
+ "!" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[DO #{args}] } },
147
+ "@" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[AT #{args}] } }
148
+ }
149
+ def self.cues
150
+ @@U
151
+ end
152
+ @@H = {
153
+ ":" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[OUR #{args}] } },
154
+ "!" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[DO #{args}] } },
155
+ "@" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[AT #{args}] } }
156
+ }
157
+ def self.handle
158
+ @@H
159
+ end
160
+ @@O = {
161
+ ":" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[OUR #{args}] } },
162
+ "!" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[DO #{args}] } },
163
+ "@" => Hash.new { |hh, key| hh[key] = lambda { |*args| puts %[AT #{args}] } }
164
+ }
165
+ def self.operate
166
+ @@O
167
+ end
168
+ end
169
+
170
+ Needabot.on(:chan) { |m| puts %[CHAN: #{m}] }
171
+ Needabot.on(:priv) { |m| puts %[PRIV: #{m}] }
172
+
173
+ Needabot.chan['^(?<t>[:!@])(?<k>\w+)(?<v>\s.*)?$'] = lambda { |a, h|
174
+ puts %[chan: t: #{a[:t]}, k: #{a[:k]}, v: #{a[:v]}\nH: #{h}]
175
+ if a[:v] != nil && "#{a[:v]}".length > 0
176
+ hh = { trigger: a[:t], key: a[:k], value: a[:v].strip }
177
+ Needabot.msg({ h[:from] => ME.operate[a[:t]][a[:k]].call(hh, h) })
178
+ Needabot.msg({ Needabot::CHANNEL => ME.handle[a[:t]][a[:k]].call(hh, h) })
179
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:handle].call(hh, h), h[:from] => ME.can[:handle].call(hh, h) })
180
+ else
181
+ hh = { trigger: a[:t], key: a[:k] }
182
+ Needabot.msg({ h[:from] => ME.operate[a[:t]][a[:k]].call(hh, h) })
183
+ Needabot.msg({ Needabot::CHANNEL => ME.handle[a[:t]][a[:k]].call(hh, h) })
184
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:find].call(hh, h), h[:from] => ME.can[:find].call(hh, h) })
185
+ end
186
+ nil
187
+ }
188
+
189
+ Needabot.chan['^(?<raw>.*)?$'] = lambda { |a, h|
190
+ if m = /ACTION (?<act>.*)/.match(a[:raw])
191
+ # puts %[###### CHANACT h[:from] = #{h[:from]}; m[:act] = #{m[:act]}]
192
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:see].call(m, h), h[:from] => ME.can[:see].call(m, h) })
193
+ elsif m = /^#{Needabot::NICK}: (?<ask>.*)$/.match(a[:raw])
194
+ # puts %[###### CHANASK from: (#{h[:from]} asked #{m[:ask]}]
195
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:ask].call(m, h), h[:from] => ME.can[:ask].call(m, h) })
196
+ elsif m = /^(?<who>.+): (?<what>.*)$/.match(a[:raw])
197
+ # puts %[###### CHANDM from: (#{h[:from]} who: #{m[:who]} => what: #{m[:what]}]
198
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:tell].call(m, h), h[:from] => ME.can[:tell].call(m, h) })
199
+ elsif h[:type] == "privmsg"
200
+ # puts %[###### CHANRAW #{a[:raw]}]
201
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:hear].call({ raw: a[:raw] }, h), h[:from] => ME.can[:hear].call({ raw: a[:raw] }, h) })
202
+ else
203
+ # puts %[RAW: #{a[:raw]}\nH: #{h}];
204
+ end
205
+ nil
206
+ }
207
+
208
+ # priv
209
+ Needabot.priv['^(?<t>[:!@])(?<k>\w+)(?<v>\s.*)?$'] = lambda { |a, h|
210
+ puts %[priv: t: #{a[:t]}, k: #{a[:k]}, v: #{a[:v]}\nH: #{h}]
211
+ if "#{a[:v]}".length > 0
212
+ hh = { trigger: a[:t], key: a[:k], value: a[:v].strip }
213
+ Needabot.msg({ Needabot::CHANNEL => ME.triggers[a[:t]][a[:k]].call(hh, h) })
214
+ Needabot.msg({ h[:from] => ME.cues[a[:t]][a[:k]].call(hh, h) })
215
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:trigger].call(hh, h), h[:from] => ME.can[:trigger].call(hh, h) })
216
+ else
217
+ hh = { trigger: a[:t], key: a[:k] }
218
+ Needabot.msg({ Needabot::CHANNEL => ME.triggers[a[:t]][a[:k]].call(hh, h) })
219
+ Needabot.msg({ h[:from] => ME.cues[a[:t]][a[:k]].call(hh, h) })
220
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:operate].call(hh, h), h[:from] => ME.can[:operate].call(hh, h) })
221
+ end
222
+ nil
223
+ }
224
+
225
+ Needabot.priv['^(?<raw>.*)?$'] = lambda { |a, h|
226
+ # puts %[RAW: #{a[:raw]}\nH: #{h}];
227
+
228
+ if h[:type] == "privmsg"
229
+ if m = /ACTION (.*)/.match(a[:raw])
230
+ # puts %[###### PRIVACT #{m[1]}]
231
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:act].call({ act: m[1] }, h), h[:from] => ME.can[:act].call({ act: m[1] }, h) })
232
+ elsif m = /ON (?<input>.*) SAY (?<output>.*)/.match(a[:raw])
233
+ # puts %[###### PRIVON #{m[1]}]
234
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:on].call(m, h), h[:from] => ME.can[:on].call(m, h) })
235
+ elsif m = /I (?<fact>.*)/.match(a[:raw])
236
+ # puts %[###### PRIVFACT #{m[:fact]}]
237
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:fact].call(m, h), h[:from] => ME.can[:fact].call(m, h) })
238
+ elsif m = /IF (?<input>.*) SAY (?<output>.*)/.match(a[:raw])
239
+ # puts %[###### PRIVCOND #{m[:fact]}]
240
+ Needabot.msg({ Needabot::CHANNEL => ME.we.will[:cond].call(m, h), h[:from] => ME.can[:cond].call(m, h) })
241
+ else
242
+ # puts %[###### PRIVMSG #{a[:raw]}]
243
+ Needabot.msg({ Needabot::CHANNEL => ME.can[:read].call({ raw: a[:raw] }, h), h[:from] => ME.can[:know].call({ raw: a[:raw] }, h) })
244
+ end
245
+ elsif h[:type] == "366"
246
+ # puts %[###### JOIN]
247
+ ME.we.will[:join].call()
248
+ elsif h[:type] == "353"
249
+ # puts %[###### CONNECT]
250
+ elsif h[:type] == "376"
251
+ # puts %[###### DONE]
252
+ elsif h[:type] == "372"
253
+ # puts %[###### TEXT]
254
+ elsif h[:type] == "375"
255
+ # puts %[###### MOTD]
256
+ elsif h[:type] == "250"
257
+ # puts %[###### HIGH]
258
+ elsif h[:type] == "266"
259
+ # puts %[###### RAW-266]
260
+ elsif h[:type] == "265"
261
+ # puts %[###### RAW-265]
262
+ elsif h[:type] == "255"
263
+ # puts %[###### CLIENTS]
264
+ elsif h[:type] == "254"
265
+ # puts %[###### RAW-254]
266
+ elsif h[:type] == "253"
267
+ # puts %[###### RAW-253]
268
+ elsif h[:type] == "252"
269
+ # puts %[###### RAW-252]
270
+ elsif h[:type] == "251"
271
+ # puts %[###### USERS]
272
+ elsif h[:type] == "003"
273
+ # puts %[###### BORN]
274
+ elsif h[:type] == "002"
275
+ # puts %[###### HOST]
276
+ elsif h[:type] == "004"
277
+ # puts %[###### SERVER]
278
+ elsif h[:type] == "001"
279
+ # puts %[###### NETWORK]
280
+ ME.we.will[:connect].call()
281
+ elsif h[:type] == "005"
282
+ # puts %[###### CAP]
283
+ elsif h[:type] == "mode"
284
+ # puts %[###### MODE]
285
+ else
286
+ puts %[RAW: #{a[:raw]}\nH: #{h}];
287
+ end
288
+ nil
289
+ }
290
+
291
+ [':','!','@'].each do |e|
292
+ ME.triggers[e]['help'] = lambda { |*a| %[help asked for: #{e} #{a}] }
293
+ ME.cues[e]['help'] = lambda { |*a| %[help needed: #{e} #{a}] }
294
+ ME.handle[e]['help'] = lambda { |*a| %[I will be right with you: #{e} #{a}] }
295
+ ME.operate[e]['help'] = lambda { |*a| %[You asked for help in the channel: #{e} #{a}] }
296
+ end
297
+
298
+ [':','!','@'].each do |e|
299
+ ME.triggers[e]['hi'] = lambda { |*a| %[HI (user->chan)[chan]: #{e} #{a}] }
300
+ ME.cues[e]['hi'] = lambda { |*a| %[HI (user->chan)[user]: #{e} #{a}] }
301
+ ME.handle[e]['hi'] = lambda { |*a| %[HI (chan->user)[chan]: #{e} #{a}] }
302
+ ME.operate[e]['hi'] = lambda { |*a| %[HI (chan->user)[user]: #{e} #{a}] }
303
+ end
304
+
305
+ if File.exist? 'bot.rb'
306
+ puts %[=> bot]
307
+
308
+ load 'bot.rb'
309
+ end
data/sig/needabot.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Needabot
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: needabot
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Erik Olson
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-04-24 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: zircon
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
26
+ description: A simple irc bot framework.
27
+ email:
28
+ - xorgnak@gmail.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - CHANGELOG.md
34
+ - CODE_OF_CONDUCT.md
35
+ - LICENSE.txt
36
+ - README.md
37
+ - Rakefile
38
+ - lib/needabot.rb
39
+ - lib/needabot/version.rb
40
+ - sig/needabot.rbs
41
+ homepage: https://github.com/xorgnak/needabot
42
+ licenses:
43
+ - MIT
44
+ metadata:
45
+ homepage_uri: https://github.com/xorgnak/needabot
46
+ source_code_uri: https://github.com/xorgnak/needabot
47
+ changelog_uri: https://github.com/xorgnak/needabot
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.1.0
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.6.3
63
+ specification_version: 4
64
+ summary: ircbot.
65
+ test_files: []