beerbot 0.1.5 → 0.2.0.pre.1
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 +4 -4
- data/bin/{run-irc.rb → beerbot-run-irc.rb} +9 -3
- data/lib/RunIRC.rb +46 -18
- data/lib/beerbot.rb +17 -0
- data/lib/{BeerBot → beerbot}/00.utils/InOut.rb +0 -0
- data/lib/beerbot/00.utils/utils.rb +34 -0
- data/lib/{BeerBot → beerbot}/01.bot/Bot.rb +49 -21
- data/lib/{BeerBot → beerbot}/01.bot/BotModule.rb +0 -0
- data/lib/{BeerBot → beerbot}/01.bot/botmsg.rb +51 -0
- data/lib/{BeerBot → beerbot}/01.connect/IRCConnection.rb +39 -19
- data/lib/{BeerBot → beerbot}/02.protocols/irc.rb +1 -1
- data/lib/{BeerBot → beerbot}/06.dispatchers/dispatcher.rb +32 -67
- data/lib/{BeerBot → beerbot}/70.scheduler/scheduler.rb +0 -0
- data/lib/{BeerBot → beerbot}/Config.rb +36 -3
- metadata +17 -24
- data/lib/BeerBot.rb +0 -22
- data/lib/BeerBot/00.utils/DataFile.rb +0 -103
- data/lib/BeerBot/00.utils/More.rb +0 -68
- data/lib/BeerBot/00.utils/param_expand.rb +0 -105
- data/lib/BeerBot/00.utils/sentence_expand.rb +0 -77
- data/lib/BeerBot/00.utils/utils.rb +0 -92
- data/lib/BeerBot/00.utils/world/IRCWorld.rb +0 -47
- data/lib/BeerBot/00.utils/world/World.rb +0 -74
- data/lib/BeerBot/01.bot/BotMsgMore.rb +0 -35
@@ -1,35 +0,0 @@
|
|
1
|
-
# The files in this directory are part of BeerBot, a a ruby irc bot library.
|
2
|
-
# Copyright (C) 2014 Daniel Bush
|
3
|
-
# This program is distributed under the terms of the GNU
|
4
|
-
# General Public License. A copy of the license should be
|
5
|
-
# enclosed with this project in the file LICENSE. If not
|
6
|
-
# see <http://www.gnu.org/licenses/>.
|
7
|
-
|
8
|
-
require_relative '../00.utils/More'
|
9
|
-
|
10
|
-
module BeerBot
|
11
|
-
|
12
|
-
# More-based filter that can be applied to botmsg's.
|
13
|
-
#
|
14
|
-
# #filter expects a botmsg and returns an array, either of botmsg's
|
15
|
-
# or emtpy.
|
16
|
-
|
17
|
-
class BotMsgMore < ::BeerBot::Utils::More
|
18
|
-
def filter botmsg
|
19
|
-
arr = BeerBot::BotMsg.to_a(botmsg)
|
20
|
-
# At this point if arr isn't a valid bot msg we'll get [].
|
21
|
-
replies = []
|
22
|
-
by_to = Hash.new{|h,k| h[k]=[]}
|
23
|
-
|
24
|
-
arr.inject(by_to){|h,v| h[v[:to]].push(v); h}
|
25
|
-
by_to.each_pair{|to,a|
|
26
|
-
replies += super(a,to)
|
27
|
-
if replies.size < a.size then
|
28
|
-
replies += [msg:"Type: more",to:to]
|
29
|
-
end
|
30
|
-
}
|
31
|
-
return replies
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|