Browse Source

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

master
Syfaro 2 years 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.
package main

import (
"github.com/syfaro/finch"
_ "github.com/syfaro/finch/commands/help"
_ "github.com/syfaro/finch/commands/info"
_ "github.com/syfaro/finch/commands/stats"
"github.com/Syfaro/finch"
_ "github.com/Syfaro/finch/commands/help"
_ "github.com/Syfaro/finch/commands/info"
_ "github.com/Syfaro/finch/commands/stats"
)

func main() {
@@ -33,10 +33,10 @@ The webhook listener code is currently untested, and requires running a `net/htt
package main

import (
"github.com/syfaro/finch"
_ "github.com/syfaro/finch/commands/help"
_ "github.com/syfaro/finch/commands/info"
_ "github.com/syfaro/finch/commands/stats"
"github.com/Syfaro/finch"
_ "github.com/Syfaro/finch/commands/help"
_ "github.com/Syfaro/finch/commands/info"
_ "github.com/Syfaro/finch/commands/stats"
"net/http"
)



+ 3
- 2
commands.go View File

@@ -1,11 +1,12 @@
package finch

import (
"github.com/getsentry/raven-go"
"gopkg.in/telegram-bot-api.v4"
"log"
"regexp"
"strings"

"github.com/getsentry/raven-go"
"gopkg.in/telegram-bot-api.v4"
)

var commands []*CommandState


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

@@ -1,7 +1,7 @@
package commands

import (
"github.com/syfaro/finch"
"github.com/Syfaro/finch"
"gopkg.in/telegram-bot-api.v4"
)



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

@@ -2,7 +2,8 @@ package commands

import (
"bytes"
"github.com/syfaro/finch"

"github.com/Syfaro/finch"
"gopkg.in/telegram-bot-api.v4"
)



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

@@ -2,7 +2,8 @@ package commands

import (
"fmt"
"github.com/syfaro/finch"

"github.com/Syfaro/finch"
"gopkg.in/telegram-bot-api.v4"
)



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

@@ -2,9 +2,10 @@ package commands

import (
"bytes"
"github.com/syfaro/finch"
"gopkg.in/telegram-bot-api.v4"
"strconv"

"github.com/Syfaro/finch"
"gopkg.in/telegram-bot-api.v4"
)

type UserMessageCount map[string]int


+ 10
- 11
commands_test.go View File

@@ -1,7 +1,6 @@
package finch_test
package finch

import (
"github.com/syfaro/finch"
"testing"
)

@@ -12,23 +11,23 @@ func TestSimpleCommand(t *testing.T) {
goodMessage4 := "/start@FinchExampleBot param1 param2"
badMessage := "/stop"

if !finch.SimpleCommand("start", goodMessage) {
if !SimpleCommand("start", goodMessage) {
t.Error("goodMessage did not return true")
}

if !finch.SimpleCommand("start", goodMessage2) {
if !SimpleCommand("start", goodMessage2) {
t.Error("goodMessage2 did not return true")
}

if !finch.SimpleCommand("start", goodMessage3) {
if !SimpleCommand("start", goodMessage3) {
t.Error("goodMessage3 did not return true")
}

if !finch.SimpleCommand("start", goodMessage4) {
if !SimpleCommand("start", goodMessage4) {
t.Error("goodMessage4 did not return true")
}

if finch.SimpleCommand("start", badMessage) {
if SimpleCommand("start", badMessage) {
t.Error("badMessage did not return false")
}
}
@@ -39,19 +38,19 @@ func TestSimpleArgCommand(t *testing.T) {
badMessage := "/start arg1"
badMessage2 := "/start arg1 arg2 arg3"

if !finch.SimpleArgCommand("start", 2, goodMessage) {
if !SimpleArgCommand("start", 2, goodMessage) {
t.Error("goodMessage did not return true")
}

if !finch.SimpleArgCommand("start", 2, goodMessage2) {
if !SimpleArgCommand("start", 2, goodMessage2) {
t.Error("goodMessage2 did not return true")
}

if finch.SimpleArgCommand("start", 2, badMessage) {
if SimpleArgCommand("start", 2, badMessage) {
t.Error("badMessage did not return false")
}

if finch.SimpleArgCommand("start", 2, badMessage2) {
if SimpleArgCommand("start", 2, badMessage2) {
t.Error("badMessage2 did not return false")
}
}

+ 3
- 2
finch.go View File

@@ -3,13 +3,14 @@ package finch

import (
"encoding/json"
"github.com/getsentry/raven-go"
"gopkg.in/telegram-bot-api.v4"
"io/ioutil"
"log"
"net/http"
"os"
"strings"

"github.com/getsentry/raven-go"
"gopkg.in/telegram-bot-api.v4"
)

// Config is a type used for storing configuration information.


+ 2
- 1
types.go View File

@@ -2,8 +2,9 @@ package finch

import (
"bytes"
"gopkg.in/telegram-bot-api.v4"
"sync"

"gopkg.in/telegram-bot-api.v4"
)

// Help contains information about a command,


Loading…
Cancel
Save