Browse Source

Consistent capitalization to fix Travis, move tests into same package.

Syfaro 8 months ago
parent
commit
33bec5ece2
9 changed files with 34 additions and 29 deletions
  1. 8
    8
      README.md
  2. 3
    2
      commands.go
  3. 1
    1
      commands/cancel/cancel.go
  4. 2
    1
      commands/help/help.go
  5. 2
    1
      commands/info/info.go
  6. 3
    2
      commands/stats/stats.go
  7. 10
    11
      commands_test.go
  8. 3
    2
      finch.go
  9. 2
    1
      types.go

+ 8
- 8
README.md View File

@@ -14,10 +14,10 @@ It's fairly easy to get this bot running, it requires few lines of code.
14 14
 package main
15 15
 
16 16
 import (
17
-	"github.com/syfaro/finch"
18
-	_ "github.com/syfaro/finch/commands/help"
19
-	_ "github.com/syfaro/finch/commands/info"
20
-	_ "github.com/syfaro/finch/commands/stats"
17
+	"github.com/Syfaro/finch"
18
+	_ "github.com/Syfaro/finch/commands/help"
19
+	_ "github.com/Syfaro/finch/commands/info"
20
+	_ "github.com/Syfaro/finch/commands/stats"
21 21
 )
22 22
 
23 23
 func main() {
@@ -33,10 +33,10 @@ The webhook listener code is currently untested, and requires running a `net/htt
33 33
 package main
34 34
 
35 35
 import (
36
-	"github.com/syfaro/finch"
37
-	_ "github.com/syfaro/finch/commands/help"
38
-	_ "github.com/syfaro/finch/commands/info"
39
-	_ "github.com/syfaro/finch/commands/stats"
36
+	"github.com/Syfaro/finch"
37
+	_ "github.com/Syfaro/finch/commands/help"
38
+	_ "github.com/Syfaro/finch/commands/info"
39
+	_ "github.com/Syfaro/finch/commands/stats"
40 40
 	"net/http"
41 41
 )
42 42
 

+ 3
- 2
commands.go View File

@@ -1,11 +1,12 @@
1 1
 package finch
2 2
 
3 3
 import (
4
-	"github.com/getsentry/raven-go"
5
-	"gopkg.in/telegram-bot-api.v4"
6 4
 	"log"
7 5
 	"regexp"
8 6
 	"strings"
7
+
8
+	"github.com/getsentry/raven-go"
9
+	"gopkg.in/telegram-bot-api.v4"
9 10
 )
10 11
 
11 12
 var commands []*CommandState

+ 1
- 1
commands/cancel/cancel.go View File

@@ -1,7 +1,7 @@
1 1
 package commands
2 2
 
3 3
 import (
4
-	"github.com/syfaro/finch"
4
+	"github.com/Syfaro/finch"
5 5
 	"gopkg.in/telegram-bot-api.v4"
6 6
 )
7 7
 

+ 2
- 1
commands/help/help.go View File

@@ -2,7 +2,8 @@ package commands
2 2
 
3 3
 import (
4 4
 	"bytes"
5
-	"github.com/syfaro/finch"
5
+
6
+	"github.com/Syfaro/finch"
6 7
 	"gopkg.in/telegram-bot-api.v4"
7 8
 )
8 9
 

+ 2
- 1
commands/info/info.go View File

@@ -2,7 +2,8 @@ package commands
2 2
 
3 3
 import (
4 4
 	"fmt"
5
-	"github.com/syfaro/finch"
5
+
6
+	"github.com/Syfaro/finch"
6 7
 	"gopkg.in/telegram-bot-api.v4"
7 8
 )
8 9
 

+ 3
- 2
commands/stats/stats.go View File

@@ -2,9 +2,10 @@ package commands
2 2
 
3 3
 import (
4 4
 	"bytes"
5
-	"github.com/syfaro/finch"
6
-	"gopkg.in/telegram-bot-api.v4"
7 5
 	"strconv"
6
+
7
+	"github.com/Syfaro/finch"
8
+	"gopkg.in/telegram-bot-api.v4"
8 9
 )
9 10
 
10 11
 type UserMessageCount map[string]int

+ 10
- 11
commands_test.go View File

@@ -1,7 +1,6 @@
1
-package finch_test
1
+package finch
2 2
 
3 3
 import (
4
-	"github.com/syfaro/finch"
5 4
 	"testing"
6 5
 )
7 6
 
@@ -12,23 +11,23 @@ func TestSimpleCommand(t *testing.T) {
12 11
 	goodMessage4 := "/start@FinchExampleBot param1 param2"
13 12
 	badMessage := "/stop"
14 13
 
15
-	if !finch.SimpleCommand("start", goodMessage) {
14
+	if !SimpleCommand("start", goodMessage) {
16 15
 		t.Error("goodMessage did not return true")
17 16
 	}
18 17
 
19
-	if !finch.SimpleCommand("start", goodMessage2) {
18
+	if !SimpleCommand("start", goodMessage2) {
20 19
 		t.Error("goodMessage2 did not return true")
21 20
 	}
22 21
 
23
-	if !finch.SimpleCommand("start", goodMessage3) {
22
+	if !SimpleCommand("start", goodMessage3) {
24 23
 		t.Error("goodMessage3 did not return true")
25 24
 	}
26 25
 
27
-	if !finch.SimpleCommand("start", goodMessage4) {
26
+	if !SimpleCommand("start", goodMessage4) {
28 27
 		t.Error("goodMessage4 did not return true")
29 28
 	}
30 29
 
31
-	if finch.SimpleCommand("start", badMessage) {
30
+	if SimpleCommand("start", badMessage) {
32 31
 		t.Error("badMessage did not return false")
33 32
 	}
34 33
 }
@@ -39,19 +38,19 @@ func TestSimpleArgCommand(t *testing.T) {
39 38
 	badMessage := "/start arg1"
40 39
 	badMessage2 := "/start arg1 arg2 arg3"
41 40
 
42
-	if !finch.SimpleArgCommand("start", 2, goodMessage) {
41
+	if !SimpleArgCommand("start", 2, goodMessage) {
43 42
 		t.Error("goodMessage did not return true")
44 43
 	}
45 44
 
46
-	if !finch.SimpleArgCommand("start", 2, goodMessage2) {
45
+	if !SimpleArgCommand("start", 2, goodMessage2) {
47 46
 		t.Error("goodMessage2 did not return true")
48 47
 	}
49 48
 
50
-	if finch.SimpleArgCommand("start", 2, badMessage) {
49
+	if SimpleArgCommand("start", 2, badMessage) {
51 50
 		t.Error("badMessage did not return false")
52 51
 	}
53 52
 
54
-	if finch.SimpleArgCommand("start", 2, badMessage2) {
53
+	if SimpleArgCommand("start", 2, badMessage2) {
55 54
 		t.Error("badMessage2 did not return false")
56 55
 	}
57 56
 }

+ 3
- 2
finch.go View File

@@ -3,13 +3,14 @@ package finch
3 3
 
4 4
 import (
5 5
 	"encoding/json"
6
-	"github.com/getsentry/raven-go"
7
-	"gopkg.in/telegram-bot-api.v4"
8 6
 	"io/ioutil"
9 7
 	"log"
10 8
 	"net/http"
11 9
 	"os"
12 10
 	"strings"
11
+
12
+	"github.com/getsentry/raven-go"
13
+	"gopkg.in/telegram-bot-api.v4"
13 14
 )
14 15
 
15 16
 // Config is a type used for storing configuration information.

+ 2
- 1
types.go View File

@@ -2,8 +2,9 @@ package finch
2 2
 
3 3
 import (
4 4
 	"bytes"
5
-	"gopkg.in/telegram-bot-api.v4"
6 5
 	"sync"
6
+
7
+	"gopkg.in/telegram-bot-api.v4"
7 8
 )
8 9
 
9 10
 // Help contains information about a command,