Browse Source

Some formatting.

Abhinav Sarkar 6 years ago
parent
commit
9d43374cdb
1 changed files with 27 additions and 28 deletions
  1. 27
    28
      README.md

+ 27
- 28
README.md View File

@@ -1,6 +1,7 @@
1 1
 #Hircarra
2 2
 
3 3
 > hircarra (plural hircarras)
4
+> 
4 5
 > (historical, India) A messenger, especially one who delivers a personal message.
5 6
 
6 7
 Hircarra is a Haskell library to write [IRC][1] bots. It is meant to be very easy to use and completely extensible. It provides a core on which users can add support for their own IRC messages and replies and handlers. It also comes with a set of handlers (in the hircarra-handlers package) which provide a varied set of functionalities.
@@ -73,23 +74,24 @@ GHCi, version 7.8.3: http://www.haskell.org/ghc/  :? for help
73 74
 Loading package ghc-prim ... linking ... done.
74 75
 Loading package integer-gmp ... linking ... done.
75 76
 Loading package base ... linking ... done.
76
-Prelude> :m +Data.Map
77
-Prelude Data.Map> :m +Network.IRC
78
-Prelude Data.Map Network.IRC> :set +m
79
-Prelude Data.Map Network.IRC> :set -XOverloadedStrings
80
-Prelude Data.Map Network.IRC> let echoHandler = MsgHandlerMaker "echo" $ \ _ _ -> return $ newMsgHandler {
81
-Prelude Data.Map Network.IRC|   onMessage = \ Message { message = message } ->
82
-Prelude Data.Map Network.IRC|     case fromMessage message of
83
-Prelude Data.Map Network.IRC|       Just (ChannelMsg _ msg) -> do
84
-Prelude Data.Map Network.IRC|         reply <- newMessage (ChannelMsgReply msg)
85
-Prelude Data.Map Network.IRC|         return [reply]
86
-Prelude Data.Map Network.IRC|       _ -> return []
87
-Prelude Data.Map Network.IRC| }
88
-Prelude Data.Map Network.IRC|
89
-Prelude Data.Map Network.IRC> let botConfig = newBotConfig "irc.freenode.net" 6667 "#hircarra" (Nick "hibot") 130 DEBUG
90
-Prelude Data.Map Network.IRC> let botConfigWithHandler = botConfig { msgHandlerMakers = singleton "echo" echoHandler, msgHandlerInfo = singleton "echo" empty }
91
-Prelude Data.Map Network.IRC|
92
-Prelude Data.Map Network.IRC> runBot botConfigWithHandler
77
+Prelude> :set prompt  "λ: "
78
+λ> :m +Data.Map
79
+λ> :m +Network.IRC
80
+λ> :set +m
81
+λ> :set -XOverloadedStrings
82
+λ> let echoHandler = MsgHandlerMaker "echo" $ \ _ _ -> return $ newMsgHandler {
83
+λ|   onMessage = \ Message { message = message } ->
84
+λ|     case fromMessage message of
85
+λ|       Just (ChannelMsg _ msg) -> do
86
+λ|         reply <- newMessage (ChannelMsgReply msg)
87
+λ|         return [reply]
88
+λ|       _ -> return []
89
+λ| }
90
+λ|
91
+λ> let botConfig = newBotConfig "irc.freenode.net" 6667 "#hircarra" (Nick "hibot") 130 DEBUG
92
+λ> let botConfigWithHandler = botConfig { msgHandlerMakers = singleton "echo" echoHandler, msgHandlerInfo = singleton "echo" empty }
93
+λ|
94
+λ> runBot botConfigWithHandler
93 95
 [2015-06-29 18:28:43] Network.IRC.Client DEBUG Connecting ...
94 96
 [2015-06-29 18:28:43] Network.IRC.Client DEBUG Connected
95 97
 [2015-06-29 18:28:43] Network.IRC.Client DEBUG Loading msg handler: echo
@@ -131,16 +133,13 @@ handlers = ["echo","help","pingpong"] }
131 133
 
132 134
 Here is how the conversation looked in an IRC client:
133 135
 
134
-> [23:58:56] 	hibot (~hibot@106.51.139.38) joined the channel
135
-> 
136
-> [23:58:59]  <@abh>	test test
137
-> 
138
-> [23:59:00]  <hibot>	test test
139
-> 
140
-> [23:59:05]  <@abh>	repeater
141
-> 
142
-> [23:59:06]  <hibot>	repeater
143
-> 
144
-> [23:59:11] 	hibot (~hibot@106.51.139.38) left IRC (Client Quit)
136
+```
137
+[23:58:56] 	hibot (~hibot@106.51.139.38) joined the channel
138
+[23:58:59]  <@abh>	test test
139
+[23:59:00]  <hibot>	test test
140
+[23:59:05]  <@abh>	repeater
141
+[23:59:06]  <hibot>	repeater
142
+[23:59:11] 	hibot (~hibot@106.51.139.38) left IRC (Client Quit)
143
+```
145 144
 
146 145
 [1]: https://en.wikipedia.org/wiki/Irc

Loading…
Cancel
Save