Browse Source

README

tags/v0.2.0
Chris Smith 5 years ago
parent
commit
25e6e40855
2 changed files with 52 additions and 1 deletions
  1. 49
    0
      README.md
  2. 3
    1
      src/main/kotlin/com/dmdirc/ktirc/IrcClient.kt

+ 49
- 0
README.md View File

@@ -0,0 +1,49 @@
1
+# KtIrc
2
+
3
+[![Download](https://api.bintray.com/packages/dmdirc/releases/ktirc/images/download.svg)](https://bintray.com/dmdirc/releases/ktirc/_latestVersion) 
4
+
5
+KtIrc is a Kotlin JVM library for connecting to and interacting with IRC servers.
6
+It is still in an early stage of development.
7
+
8
+## Setup
9
+
10
+KtIrc is published to JCenter, so adding it to a gradle build is as simple as:
11
+
12
+```groovy
13
+repositories {
14
+    jcenter()
15
+}
16
+
17
+dependencies {
18
+    implementation("com.dmdirc:ktirc:<VERSION>")
19
+}
20
+```
21
+
22
+## Usage
23
+
24
+The main interface for interacting with KtIrc is the `IrcClientImpl` class. A
25
+simple bot might look like:
26
+
27
+```kotlin
28
+val client = IrcClientImpl(Server("my.server.com", 6667), Profile("nick", "realName", "userName"))
29
+client.onEvent { event ->
30
+    when (event) {
31
+        is ServerWelcome ->
32
+            client.send(joinMessage("#ktirc"))
33
+        is MessageReceived ->
34
+            if (event.message == "!test")
35
+                client.send(privmsgMessage(event.target, "Test successful!"))
36
+    }
37
+}
38
+client.connect()
39
+```
40
+
41
+## Contributing
42
+
43
+Contributing is welcomed and encouraged! Please try to add unit tests for new features,
44
+and maintain a code style consistent with the existing code.
45
+
46
+## Licence
47
+
48
+The code in this repository is released under the MIT licence. See the
49
+[LICENCE](LICENCE) file for more info.

+ 3
- 1
src/main/kotlin/com/dmdirc/ktirc/IrcClient.kt View File

@@ -101,7 +101,9 @@ fun main() {
101 101
         client.onEvent { event ->
102 102
             when (event) {
103 103
                 is ServerWelcome -> client.send(joinMessage("#ktirc"))
104
-                is MessageReceived -> if (event.message == "!test") client.send(privmsgMessage(event.target, "Test successful!"))
104
+                is MessageReceived ->
105
+                    if (event.message == "!test")
106
+                        client.send(privmsgMessage(event.target, "Test successful!"))
105 107
             }
106 108
         }
107 109
         client.connect()

Loading…
Cancel
Save