Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ras0q/traq-chat

Make creating traQ chat-bot easier.
https://github.com/ras0q/traq-chat

bot traq

Last synced: 3 months ago
JSON representation

Make creating traQ chat-bot easier.

Awesome Lists containing this project

README

        

# traq-chat

Make creating traQBot easier.

## Example

```go
package main

import (
"fmt"
"os"
"regexp"

traqchat "github.com/ras0q/traq-chat"
)

func main() {
q := traqchat.New(
os.Getenv("BOT_ID"),
os.Getenv("BOT_USER_ID"),
os.Getenv("BOT_ACCESS_TOKEN"),
os.Getenv("BOT_VERIFICATION_TOKEN"),
)

q.Hear(regexp.MustCompile(`ping`), func(res *traqchat.Response) error {
res.Send("pong!")

return nil
})

q.Respond(regexp.MustCompile(`Hello`), hello)

q.Start(80)
}

func hello(res *traqchat.Response) error {
res.Reply(fmt.Sprintf("Hello, %s\n", res.Message.User.DisplayName))

return nil
}
```

## More Information for traQ Bot

- [traPtitech/traq-bot: traQ BOT用Goライブラリ](https://github.com/traPtitech/traq-bot)