Skip to content

Commit

Permalink
Merge pull request #6 from gabolaev/master
Browse files Browse the repository at this point in the history
DmitryDorofeev/goicqbot -> mail-ru-im/bot-golang
  • Loading branch information
George Gabolaev authored Aug 29, 2019
2 parents 7b1432c + a2a4fb5 commit e233895
Show file tree
Hide file tree
Showing 19 changed files with 117 additions and 112 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="https://github.com/mail-ru-im/bot-python/blob/master/logo.png" width="100" height="100">

# Golang interface for ICQ bot API
# Golang interface for bot API
[![CircleCI](https://circleci.com/gh/DmitryDorofeev/goicqbot.svg?style=svg)](https://circleci.com/gh/DmitryDorofeev/goicqbot)

- *Brand new Bot API!*
Expand All @@ -11,7 +11,7 @@

## Install
```bash
go get github.com/DmitryDorofeev/goicqbot
go get github.com/mail-ru-im/bot-golang
```

## Usage
Expand All @@ -25,10 +25,10 @@ Note a bot can only reply after the user has added it to his contacts list, or i
```go
package main

import "github.com/DmitryDorofeev/goicqbot"
import "github.com/mail-ru-im/bot-golang"

func main() {
bot, err := goicqbot.NewBot(BOT_TOKEN)
bot, err := botgolang.NewBot(BOT_TOKEN)
if err != nil {
log.Println("wrong token")
}
Expand Down Expand Up @@ -75,13 +75,12 @@ You don't need this.
But if you do, you can override bot's API URL:

```go
bot := goicqbot.NewBot(BOT_TOKEN, goicqbot.BotApiURL("https://agent.mail.ru/bot/v1"))
bot := botgolang.NewBot(BOT_TOKEN, botgolang.BotApiURL("https://agent.mail.ru/bot/v1"))
```

And debug all api requests and responses:

```go
bot := goicqbot.NewBot(BOT_TOKEN, goicqbot.BotDebug(true))
bot := botgolang.NewBot(BOT_TOKEN, botgolang.BotDebug(true))
```


Expand Down
2 changes: 1 addition & 1 deletion api_mock.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package goicqbot
package botgolang

import (
"encoding/json"
Expand Down
8 changes: 4 additions & 4 deletions bot.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package goicqbot
package botgolang

/*
💥 GoICQBot is zero-configuration library with convenient interface.
💥 botgolang is zero-configuration library with convenient interface.
Crafted with love in @mail for your awesome bots.
*/

Expand All @@ -18,7 +18,7 @@ const (
defaultDebug = false
)

// Bot is the main structure for interaction with ICQ API.
// Bot is the main structure for interaction with API.
// All fields are private, you can configure bot using config arguments in NewBot func.
type Bot struct {
ctx context.Context
Expand Down Expand Up @@ -146,7 +146,7 @@ func (b *Bot) GetUpdatesChannel(ctx context.Context) <-chan Event {
}

// NewBot returns new bot object.
// All communications with ICQ bot API must go through Bot struct.
// All communications with bot API must go through Bot struct.
// In general you don't need to configure this bot, therefore all options are optional arguments.
func NewBot(token string, opts ...BotOption) (*Bot, error) {
logger := logrus.New()
Expand Down
2 changes: 1 addition & 1 deletion chat.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package goicqbot
package botgolang

//go:generate easyjson -all chat.go

Expand Down
14 changes: 7 additions & 7 deletions chat_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package goicqbot
package botgolang

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion client_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package goicqbot
package botgolang

import (
"net/http"
Expand Down
8 changes: 4 additions & 4 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"os"
"time"

"github.com/DmitryDorofeev/goicqbot"
"github.com/mail-ru-im/bot-golang"
)

func main() {
token := os.Getenv("TOKEN")

bot, err := goicqbot.NewBot(token, goicqbot.BotDebug(true))
bot, err := botgolang.NewBot(token, botgolang.BotDebug(true))
if err != nil {
log.Fatalf("cannot connect to bot: %s", err)
}
Expand Down Expand Up @@ -53,12 +53,12 @@ func main() {
for update := range updates {
fmt.Println(update.Type, update.Payload)
switch update.Type {
case goicqbot.NEW_MESSAGE:
case botgolang.NEW_MESSAGE:
message := update.Payload.Message()
if err := message.Send(); err != nil {
log.Printf("something went wrong: %s", err)
}
case goicqbot.EDITED_MESSAGE:
case botgolang.EDITED_MESSAGE:
message := update.Payload.Message()
message.Reply("do not edit!")
}
Expand Down
2 changes: 1 addition & 1 deletion file.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package goicqbot
package botgolang

//go:generate easyjson -all file.go

Expand Down
14 changes: 7 additions & 7 deletions file_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/DmitryDorofeev/goicqbot
module github.com/mail-ru-im/bot-golang

go 1.12

Expand Down
3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hako/durafmt v0.0.0-20190612201238-650ed9f29a84 h1:RvcDqcKLua4b/jtXez7ZVe9s6Iq5N6ujVevqY4FBQmM=
github.com/hako/durafmt v0.0.0-20190612201238-650ed9f29a84/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/nsf/jsondiff v0.0.0-20190712045011-8443391ee9b6 h1:qsqscDgSJy+HqgMTR+3NwjYJBbp1+honwDsszLoS+pA=
github.com/nsf/jsondiff v0.0.0-20190712045011-8443391ee9b6/go.mod h1:uFMI8w+ref4v2r9jz+c9i1IfIttS/OkmLfrk1jne5hs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
Expand Down
4 changes: 2 additions & 2 deletions message.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package goicqbot
package botgolang

import (
"fmt"
Expand All @@ -17,7 +17,7 @@ const (
Voice
)

// Message represents a text message in ICQ
// Message represents a text message
type Message struct {
client *Client
ContentType MessageContentType
Expand Down
23 changes: 15 additions & 8 deletions message_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package goicqbot
package botgolang

type BotOption interface {
Type() string
Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package goicqbot
package botgolang

//go:generate easyjson -all types.go

Expand Down
Loading

0 comments on commit e233895

Please sign in to comment.