diff options
author | Wim <wim@42.be> | 2018-08-06 21:47:05 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-08-06 21:47:05 +0200 |
commit | 51062863a5c34d81e296cf15c61140911037cf3b (patch) | |
tree | 9b5e044672486326c7a0ca8fb26430f37bf4d83c /vendor/github.com/matterbridge | |
parent | 4fb4b7aa6c02a54db8ad8dd98e4d321396926c0d (diff) | |
download | matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.gz matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.tar.bz2 matterbridge-msglm-51062863a5c34d81e296cf15c61140911037cf3b.zip |
Use mod vendor for vendored directory (backwards compatible)
Diffstat (limited to 'vendor/github.com/matterbridge')
22 files changed, 416 insertions, 745 deletions
diff --git a/vendor/github.com/matterbridge/discordgo/.travis.yml b/vendor/github.com/matterbridge/discordgo/.travis.yml new file mode 100644 index 00000000..fe626fcf --- /dev/null +++ b/vendor/github.com/matterbridge/discordgo/.travis.yml @@ -0,0 +1,14 @@ +language: go +go: + - 1.7.x + - 1.8.x + - 1.9.x +install: + - go get github.com/bwmarrin/discordgo + - go get -v . + - go get -v github.com/golang/lint/golint +script: + - diff <(gofmt -d .) <(echo -n) + - go vet -x ./... + - golint -set_exit_status ./... + - go test -v -race ./... diff --git a/vendor/github.com/matterbridge/discordgo/README.md b/vendor/github.com/matterbridge/discordgo/README.md new file mode 100644 index 00000000..acc72bf1 --- /dev/null +++ b/vendor/github.com/matterbridge/discordgo/README.md @@ -0,0 +1,130 @@ +# DiscordGo + +[![GoDoc](https://godoc.org/github.com/bwmarrin/discordgo?status.svg)](https://godoc.org/github.com/bwmarrin/discordgo) [![Go report](http://goreportcard.com/badge/bwmarrin/discordgo)](http://goreportcard.com/report/bwmarrin/discordgo) [![Build Status](https://travis-ci.org/bwmarrin/discordgo.svg?branch=master)](https://travis-ci.org/bwmarrin/discordgo) [![Discord Gophers](https://img.shields.io/badge/Discord%20Gophers-%23discordgo-blue.svg)](https://discord.gg/0f1SbxBZjYoCtNPP) [![Discord API](https://img.shields.io/badge/Discord%20API-%23go_discordgo-blue.svg)](https://discord.gg/0SBTUU1wZTWT6sqd) + +<img align="right" src="http://bwmarrin.github.io/discordgo/img/discordgo.png"> + +DiscordGo is a [Go](https://golang.org/) package that provides low level +bindings to the [Discord](https://discordapp.com/) chat client API. DiscordGo +has nearly complete support for all of the Discord API endpoints, websocket +interface, and voice interface. + +If you would like to help the DiscordGo package please use +[this link](https://discordapp.com/oauth2/authorize?client_id=173113690092994561&scope=bot) +to add the official DiscordGo test bot **dgo** to your server. This provides +indispensable help to this project. + +* See [dgVoice](https://github.com/bwmarrin/dgvoice) package for an example of +additional voice helper functions and features for DiscordGo + +* See [dca](https://github.com/bwmarrin/dca) for an **experimental** stand alone +tool that wraps `ffmpeg` to create opus encoded audio appropriate for use with +Discord (and DiscordGo) + +**For help with this package or general Go discussion, please join the [Discord +Gophers](https://discord.gg/0f1SbxBZjYq9jLBk) chat server.** + +## Getting Started + +### master vs develop Branch +* The master branch represents the latest released version of DiscordGo. This +branch will always have a stable and tested version of the library. Each release +is tagged and you can easily download a specific release and view release notes +on the github [releases](https://github.com/bwmarrin/discordgo/releases) page. + +* The develop branch is where all development happens and almost always has +new features over the master branch. However breaking changes are frequently +added to develop and even sometimes bugs are introduced. Bugs get fixed and +the breaking changes get documented before pushing to master. + +*So, what should you use?* + +If you can accept the constant changing nature of *develop* then it is the +recommended branch to use. Otherwise, if you want to tail behind development +slightly and have a more stable package with documented releases then use *master* + +### Installing + +This assumes you already have a working Go environment, if not please see +[this page](https://golang.org/doc/install) first. + +`go get` *will always pull the latest released version from the master branch.* + +```sh +go get github.com/bwmarrin/discordgo +``` + +If you want to use the develop branch, follow these steps next. + +```sh +cd $GOPATH/src/github.com/bwmarrin/discordgo +git checkout develop +``` + +### Usage + +Import the package into your project. + +```go +import "github.com/bwmarrin/discordgo" +``` + +Construct a new Discord client which can be used to access the variety of +Discord API functions and to set callback functions for Discord events. + +```go +discord, err := discordgo.New("Bot " + "authentication token") +``` + +See Documentation and Examples below for more detailed information. + + +## Documentation + +**NOTICE** : This library and the Discord API are unfinished. +Because of that there may be major changes to library in the future. + +The DiscordGo code is fairly well documented at this point and is currently +the only documentation available. Both GoDoc and GoWalker (below) present +that information in a nice format. + +- [![GoDoc](https://godoc.org/github.com/bwmarrin/discordgo?status.svg)](https://godoc.org/github.com/bwmarrin/discordgo) +- [![Go Walker](http://gowalker.org/api/v1/badge)](https://gowalker.org/github.com/bwmarrin/discordgo) +- Hand crafted documentation coming eventually. + + +## Examples + +Below is a list of examples and other projects using DiscordGo. Please submit +an issue if you would like your project added or removed from this list + +- [DiscordGo Examples](https://github.com/bwmarrin/discordgo/tree/master/examples) A collection of example programs written with DiscordGo +- [Awesome DiscordGo](https://github.com/bwmarrin/discordgo/wiki/Awesome-DiscordGo) A curated list of high quality projects using DiscordGo + +## Troubleshooting +For help with common problems please reference the +[Troubleshooting](https://github.com/bwmarrin/discordgo/wiki/Troubleshooting) +section of the project wiki. + + +## Contributing +Contributions are very welcomed, however please follow the below guidelines. + +- First open an issue describing the bug or enhancement so it can be +discussed. +- Fork the develop branch and make your changes. +- Try to match current naming conventions as closely as possible. +- This package is intended to be a low level direct mapping of the Discord API +so please avoid adding enhancements outside of that scope without first +discussing it. +- Create a Pull Request with your changes against the develop branch. + + +## List of Discord APIs + +See [this chart](https://abal.moe/Discord/Libraries.html) for a feature +comparison and list of other Discord API libraries. + +## Special Thanks + +[Chris Rhodes](https://github.com/iopred) - For the DiscordGo logo and tons of PRs diff --git a/vendor/github.com/matterbridge/discordgo/examples/airhorn/main.go b/vendor/github.com/matterbridge/discordgo/examples/airhorn/main.go deleted file mode 100644 index 21ceb76b..00000000 --- a/vendor/github.com/matterbridge/discordgo/examples/airhorn/main.go +++ /dev/null @@ -1,211 +0,0 @@ -package main - -import ( - "encoding/binary" - "flag" - "fmt" - "io" - "os" - "os/signal" - "strings" - "syscall" - "time" - - "github.com/bwmarrin/discordgo" -) - -func init() { - flag.StringVar(&token, "t", "", "Bot Token") - flag.Parse() -} - -var token string -var buffer = make([][]byte, 0) - -func main() { - - if token == "" { - fmt.Println("No token provided. Please run: airhorn -t <bot token>") - return - } - - // Load the sound file. - err := loadSound() - if err != nil { - fmt.Println("Error loading sound: ", err) - fmt.Println("Please copy $GOPATH/src/github.com/bwmarrin/examples/airhorn/airhorn.dca to this directory.") - return - } - - // Create a new Discord session using the provided bot token. - dg, err := discordgo.New("Bot " + token) - if err != nil { - fmt.Println("Error creating Discord session: ", err) - return - } - - // Register ready as a callback for the ready events. - dg.AddHandler(ready) - - // Register messageCreate as a callback for the messageCreate events. - dg.AddHandler(messageCreate) - - // Register guildCreate as a callback for the guildCreate events. - dg.AddHandler(guildCreate) - - // Open the websocket and begin listening. - err = dg.Open() - if err != nil { - fmt.Println("Error opening Discord session: ", err) - } - - // Wait here until CTRL-C or other term signal is received. - fmt.Println("Airhorn is now running. Press CTRL-C to exit.") - sc := make(chan os.Signal, 1) - signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill) - <-sc - - // Cleanly close down the Discord session. - dg.Close() -} - -// This function will be called (due to AddHandler above) when the bot receives -// the "ready" event from Discord. -func ready(s *discordgo.Session, event *discordgo.Ready) { - - // Set the playing status. - s.UpdateStatus(0, "!airhorn") -} - -// This function will be called (due to AddHandler above) every time a new -// message is created on any channel that the autenticated bot has access to. -func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { - - // Ignore all messages created by the bot itself - // This isn't required in this specific example but it's a good practice. - if m.Author.ID == s.State.User.ID { - return - } - - // check if the message is "!airhorn" - if strings.HasPrefix(m.Content, "!airhorn") { - - // Find the channel that the message came from. - c, err := s.State.Channel(m.ChannelID) - if err != nil { - // Could not find channel. - return - } - - // Find the guild for that channel. - g, err := s.State.Guild(c.GuildID) - if err != nil { - // Could not find guild. - return - } - - // Look for the message sender in that guild's current voice states. - for _, vs := range g.VoiceStates { - if vs.UserID == m.Author.ID { - err = playSound(s, g.ID, vs.ChannelID) - if err != nil { - fmt.Println("Error playing sound:", err) - } - - return - } - } - } -} - -// This function will be called (due to AddHandler above) every time a new -// guild is joined. -func guildCreate(s *discordgo.Session, event *discordgo.GuildCreate) { - - if event.Guild.Unavailable { - return - } - - for _, channel := range event.Guild.Channels { - if channel.ID == event.Guild.ID { - _, _ = s.ChannelMessageSend(channel.ID, "Airhorn is ready! Type !airhorn while in a voice channel to play a sound.") - return - } - } -} - -// loadSound attempts to load an encoded sound file from disk. -func loadSound() error { - - file, err := os.Open("airhorn.dca") - if err != nil { - fmt.Println("Error opening dca file :", err) - return err - } - - var opuslen int16 - - for { - // Read opus frame length from dca file. - err = binary.Read(file, binary.LittleEndian, &opuslen) - - // If this is the end of the file, just return. - if err == io.EOF || err == io.ErrUnexpectedEOF { - err := file.Close() - if err != nil { - return err - } - return nil - } - - if err != nil { - fmt.Println("Error reading from dca file :", err) - return err - } - - // Read encoded pcm from dca file. - InBuf := make([]byte, opuslen) - err = binary.Read(file, binary.LittleEndian, &InBuf) - - // Should not be any end of file errors - if err != nil { - fmt.Println("Error reading from dca file :", err) - return err - } - - // Append encoded pcm data to the buffer. - buffer = append(buffer, InBuf) - } -} - -// playSound plays the current buffer to the provided channel. -func playSound(s *discordgo.Session, guildID, channelID string) (err error) { - - // Join the provided voice channel. - vc, err := s.ChannelVoiceJoin(guildID, channelID, false, true) - if err != nil { - return err - } - - // Sleep for a specified amount of time before playing the sound - time.Sleep(250 * time.Millisecond) - - // Start speaking. - vc.Speaking(true) - - // Send the buffer data. - for _, buff := range buffer { - vc.OpusSend <- buff - } - - // Stop speaking - vc.Speaking(false) - - // Sleep for a specificed amount of time before ending. - time.Sleep(250 * time.Millisecond) - - // Disconnect from the provided voice channel. - vc.Disconnect() - - return nil -} diff --git a/vendor/github.com/matterbridge/discordgo/examples/appmaker/main.go b/vendor/github.com/matterbridge/discordgo/examples/appmaker/main.go deleted file mode 100644 index 5581dd93..00000000 --- a/vendor/github.com/matterbridge/discordgo/examples/appmaker/main.go +++ /dev/null @@ -1,103 +0,0 @@ -package main - -import ( - "encoding/json" - "flag" - "fmt" - "os" - - "github.com/bwmarrin/discordgo" -) - -// Variables used for command line options -var ( - Token string - Name string - DeleteID string - ListOnly bool -) - -func init() { - - flag.StringVar(&Token, "t", "", "Owner Account Token") - flag.StringVar(&Name, "n", "", "Name to give App/Bot") - flag.StringVar(&DeleteID, "d", "", "Application ID to delete") - flag.BoolVar(&ListOnly, "l", false, "List Applications Only") - flag.Parse() - - if Token == "" { - flag.Usage() - os.Exit(1) - } -} - -func main() { - - var err error - - // Create a new Discord session using the provided login information. - dg, err := discordgo.New(Token) - if err != nil { - fmt.Println("error creating Discord session,", err) - return - } - - // If -l set, only display a list of existing applications - // for the given account. - if ListOnly { - - aps, err := dg.Applications() - if err != nil { - fmt.Println("error fetching applications,", err) - return - } - - for _, v := range aps { - fmt.Println("-----------------------------------------------------") - b, _ := json.MarshalIndent(v, "", " ") - fmt.Println(string(b)) - } - return - } - - // if -d set, delete the given Application - if DeleteID != "" { - err = dg.ApplicationDelete(DeleteID) - if err != nil { - fmt.Println("error deleting application,", err) - } - return - } - - if Name == "" { - flag.Usage() - os.Exit(1) - } - - // Create a new application. - ap := &discordgo.Application{} - ap.Name = Name - ap, err = dg.ApplicationCreate(ap) - if err != nil { - fmt.Println("error creating new application,", err) - return - } - - fmt.Printf("Application created successfully:\n") - b, _ := json.MarshalIndent(ap, "", " ") - fmt.Println(string(b)) - - // Create the bot account under the application we just created - bot, err := dg.ApplicationBotCreate(ap.ID) - if err != nil { - fmt.Println("error creating bot account,", err) - return - } - - fmt.Printf("Bot account created successfully.\n") - b, _ = json.MarshalIndent(bot, "", " ") - fmt.Println(string(b)) - - fmt.Println("Please save the above posted info in a secure place.") - fmt.Println("You will need that information to login with your bot account.") -} diff --git a/vendor/github.com/matterbridge/discordgo/examples/avatar/main.go b/vendor/github.com/matterbridge/discordgo/examples/avatar/main.go deleted file mode 100644 index e0a9c880..00000000 --- a/vendor/github.com/matterbridge/discordgo/examples/avatar/main.go +++ /dev/null @@ -1,89 +0,0 @@ -package main - -import ( - "encoding/base64" - "flag" - "fmt" - "io/ioutil" - "net/http" - "os" - - "github.com/bwmarrin/discordgo" -) - -// Variables used for command line parameters -var ( - Token string - AvatarFile string - AvatarURL string -) - -func init() { - - flag.StringVar(&Token, "t", "", "Bot Token") - flag.StringVar(&AvatarFile, "f", "", "Avatar File Name") - flag.StringVar(&AvatarURL, "u", "", "URL to the avatar image") - flag.Parse() - - if Token == "" || (AvatarFile == "" && AvatarURL == "") { - flag.Usage() - os.Exit(1) - } -} - -func main() { - - // Create a new Discord session using the provided login information. - dg, err := discordgo.New("Bot " + Token) - if err != nil { - fmt.Println("error creating Discord session,", err) - return - } - - // Declare these here so they can be used in the below two if blocks and - // still carry over to the end of this function. - var base64img string - var contentType string - - // If we're using a URL link for the Avatar - if AvatarURL != "" { - - resp, err := http.Get(AvatarURL) - if err != nil { - fmt.Println("Error retrieving the file, ", err) - return - } - - defer func() { - _ = resp.Body.Close() - }() - - img, err := ioutil.ReadAll(resp.Body) - if err != nil { - fmt.Println("Error reading the response, ", err) - return - } - - contentType = http.DetectContentType(img) - base64img = base64.StdEncoding.EncodeToString(img) - } - - // If we're using a local file for the Avatar - if AvatarFile != "" { - img, err := ioutil.ReadFile(AvatarFile) - if err != nil { - fmt.Println(err) - } - - contentType = http.DetectContentType(img) - base64img = base64.StdEncoding.EncodeToString(img) - } - - // Now lets format our base64 image into the proper format Discord wants - // and then call UserUpdate to set it as our user's Avatar. - avatar := fmt.Sprintf("data:%s;base64,%s", contentType, base64img) - _, err = dg.UserUpdate("", "", "", avatar, "") - if err != nil { - fmt.Println(err) - } -} diff --git a/vendor/github.com/matterbridge/discordgo/examples/mytoken/main.go b/vendor/github.com/matterbridge/discordgo/examples/mytoken/main.go deleted file mode 100644 index 9375eadc..00000000 --- a/vendor/github.com/matterbridge/discordgo/examples/mytoken/main.go +++ /dev/null @@ -1,40 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "os" - - "github.com/bwmarrin/discordgo" -) - -// Variables used for command line parameters -var ( - Email string - Password string -) - -func init() { - - flag.StringVar(&Email, "e", "", "Account Email") - flag.StringVar(&Password, "p", "", "Account Password") - flag.Parse() - - if Email == "" || Password == "" { - flag.Usage() - os.Exit(1) - } -} - -func main() { - - // Create a new Discord session using the provided login information. - dg, err := discordgo.New(Email, Password) - if err != nil { - fmt.Println("error creating Discord session,", err) - return - } - - // Print out your token. - fmt.Printf("Your Authentication Token is:\n\n%s\n", dg.Token) -} diff --git a/vendor/github.com/matterbridge/discordgo/examples/pingpong/main.go b/vendor/github.com/matterbridge/discordgo/examples/pingpong/main.go deleted file mode 100644 index 155e782f..00000000 --- a/vendor/github.com/matterbridge/discordgo/examples/pingpong/main.go +++ /dev/null @@ -1,71 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "os" - "os/signal" - "syscall" - - "github.com/bwmarrin/discordgo" -) - -// Variables used for command line parameters -var ( - Token string -) - -func init() { - - flag.StringVar(&Token, "t", "", "Bot Token") - flag.Parse() -} - -func main() { - - // Create a new Discord session using the provided bot token. - dg, err := discordgo.New("Bot " + Token) - if err != nil { - fmt.Println("error creating Discord session,", err) - return - } - - // Register the messageCreate func as a callback for MessageCreate events. - dg.AddHandler(messageCreate) - - // Open a websocket connection to Discord and begin listening. - err = dg.Open() - if err != nil { - fmt.Println("error opening connection,", err) - return - } - - // Wait here until CTRL-C or other term signal is received. - fmt.Println("Bot is now running. Press CTRL-C to exit.") - sc := make(chan os.Signal, 1) - signal.Notify(sc, syscall.SIGINT, syscall.SIGTERM, os.Interrupt, os.Kill) - <-sc - - // Cleanly close down the Discord session. - dg.Close() -} - -// This function will be called (due to AddHandler above) every time a new -// message is created on any channel that the autenticated bot has access to. -func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { - - // Ignore all messages created by the bot itself - // This isn't required in this specific example but it's a good practice. - if m.Author.ID == s.State.User.ID { - return - } - // If the message is "ping" reply with "Pong!" - if m.Content == "ping" { - s.ChannelMessageSend(m.ChannelID, "Pong!") - } - - // If the message is "pong" reply with "Ping!" - if m.Content == "pong" { - s.ChannelMessageSend(m.ChannelID, "Ping!") - } -} diff --git a/vendor/github.com/matterbridge/discordgo/mkdocs.yml b/vendor/github.com/matterbridge/discordgo/mkdocs.yml new file mode 100644 index 00000000..3ee8eb37 --- /dev/null +++ b/vendor/github.com/matterbridge/discordgo/mkdocs.yml @@ -0,0 +1,17 @@ +site_name: DiscordGo +site_author: Bruce Marriner +site_url: http://bwmarrin.github.io/discordgo/ +repo_url: https://github.com/bwmarrin/discordgo + +dev_addr: 0.0.0.0:8000 +theme: yeti + +markdown_extensions: + - smarty + - toc: + permalink: True + - sane_lists + +pages: + - 'Home': 'index.md' + - 'Getting Started': 'GettingStarted.md' diff --git a/vendor/github.com/matterbridge/discordgo/tools/cmd/eventhandlers/main.go b/vendor/github.com/matterbridge/discordgo/tools/cmd/eventhandlers/main.go deleted file mode 100644 index 839f009d..00000000 --- a/vendor/github.com/matterbridge/discordgo/tools/cmd/eventhandlers/main.go +++ /dev/null @@ -1,124 +0,0 @@ -package main - -import ( - "bytes" - "go/format" - "go/parser" - "go/token" - "io/ioutil" - "log" - "path/filepath" - "regexp" - "sort" - "strings" - "text/template" -) - -var eventHandlerTmpl = template.Must(template.New("eventHandler").Funcs(template.FuncMap{ - "constName": constName, - "isDiscordEvent": isDiscordEvent, - "privateName": privateName, -}).Parse(`// Code generated by \"eventhandlers\"; DO NOT EDIT -// See events.go - -package discordgo - -// Following are all the event types. -// Event type values are used to match the events returned by Discord. -// EventTypes surrounded by __ are synthetic and are internal to DiscordGo. -const ({{range .}} - {{privateName .}}EventType = "{{constName .}}"{{end}} -) -{{range .}} -// {{privateName .}}EventHandler is an event handler for {{.}} events. -type {{privateName .}}EventHandler func(*Session, *{{.}}) - -// Type returns the event type for {{.}} events. -func (eh {{privateName .}}EventHandler) Type() string { - return {{privateName .}}EventType -} -{{if isDiscordEvent .}} -// New returns a new instance of {{.}}. -func (eh {{privateName .}}EventHandler) New() interface{} { - return &{{.}}{} -}{{end}} -// Handle is the handler for {{.}} events. -func (eh {{privateName .}}EventHandler) Handle(s *Session, i interface{}) { - if t, ok := i.(*{{.}}); ok { - eh(s, t) - } -} - -{{end}} -func handlerForInterface(handler interface{}) EventHandler { - switch v := handler.(type) { - case func(*Session, interface{}): - return interfaceEventHandler(v){{range .}} - case func(*Session, *{{.}}): - return {{privateName .}}EventHandler(v){{end}} - } - - return nil -} - -func init() { {{range .}}{{if isDiscordEvent .}} - registerInterfaceProvider({{privateName .}}EventHandler(nil)){{end}}{{end}} -} -`)) - -func main() { - var buf bytes.Buffer - dir := filepath.Dir(".") - - fs := token.NewFileSet() - parsedFile, err := parser.ParseFile(fs, "events.go", nil, 0) - if err != nil { - log.Fatalf("warning: internal error: could not parse events.go: %s", err) - return - } - - names := []string{} - for object := range parsedFile.Scope.Objects { - names = append(names, object) - } - sort.Strings(names) - eventHandlerTmpl.Execute(&buf, names) - - src, err := format.Source(buf.Bytes()) - if err != nil { - log.Println("warning: internal error: invalid Go generated:", err) - src = buf.Bytes() - } - - err = ioutil.WriteFile(filepath.Join(dir, strings.ToLower("eventhandlers.go")), src, 0644) - if err != nil { - log.Fatal(buf, "writing output: %s", err) - } -} - -var constRegexp = regexp.MustCompile("([a-z])([A-Z])") - -func constCase(name string) string { - return strings.ToUpper(constRegexp.ReplaceAllString(name, "${1}_${2}")) -} - -func isDiscordEvent(name string) bool { - switch { - case name == "Connect", name == "Disconnect", name == "Event", name == "RateLimit", name == "Interface": - return false - default: - return true - } -} - -func constName(name string) string { - if !isDiscordEvent(name) { - return "__" + constCase(name) + "__" - } - - return constCase(name) -} - -func privateName(name string) string { - return strings.ToLower(string(name[0])) + name[1:] -} diff --git a/vendor/github.com/matterbridge/go-xmpp/.travis.yml b/vendor/github.com/matterbridge/go-xmpp/.travis.yml new file mode 100644 index 00000000..7cf59601 --- /dev/null +++ b/vendor/github.com/matterbridge/go-xmpp/.travis.yml @@ -0,0 +1,5 @@ +language: go +go: + - tip +script: + - go test diff --git a/vendor/github.com/matterbridge/go-xmpp/README.md b/vendor/github.com/matterbridge/go-xmpp/README.md new file mode 100644 index 00000000..7808206a --- /dev/null +++ b/vendor/github.com/matterbridge/go-xmpp/README.md @@ -0,0 +1,6 @@ +go-xmpp +======= + +go xmpp library (original was written by russ cox ) + +[Documentation](https://godoc.org/github.com/mattn/go-xmpp) diff --git a/vendor/github.com/matterbridge/gomatrix/.gitignore b/vendor/github.com/matterbridge/gomatrix/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/vendor/github.com/matterbridge/gomatrix/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/vendor/github.com/matterbridge/gomatrix/.travis.yml b/vendor/github.com/matterbridge/gomatrix/.travis.yml new file mode 100644 index 00000000..fadc3264 --- /dev/null +++ b/vendor/github.com/matterbridge/gomatrix/.travis.yml @@ -0,0 +1,9 @@ +language: go +go: + - 1.8 +install: + - go get github.com/golang/lint/golint + - go get github.com/fzipp/gocyclo + - go get github.com/client9/misspell/... + - go get github.com/gordonklaus/ineffassign +script: ./hooks/pre-commit diff --git a/vendor/github.com/matterbridge/gomatrix/README.md b/vendor/github.com/matterbridge/gomatrix/README.md new file mode 100644 index 00000000..ea9109ad --- /dev/null +++ b/vendor/github.com/matterbridge/gomatrix/README.md @@ -0,0 +1,6 @@ +# gomatrix +[![GoDoc](https://godoc.org/github.com/matrix-org/gomatrix?status.svg)](https://godoc.org/github.com/matrix-org/gomatrix) + +A Golang Matrix client. + +**THIS IS UNDER ACTIVE DEVELOPMENT: BREAKING CHANGES ARE FREQUENT.** diff --git a/vendor/github.com/matterbridge/gozulipbot/.gitignore b/vendor/github.com/matterbridge/gozulipbot/.gitignore new file mode 100644 index 00000000..74775025 --- /dev/null +++ b/vendor/github.com/matterbridge/gozulipbot/.gitignore @@ -0,0 +1,2 @@ +# helper scripts +scripts/ diff --git a/vendor/github.com/matterbridge/gozulipbot/README.md b/vendor/github.com/matterbridge/gozulipbot/README.md new file mode 100644 index 00000000..631095e4 --- /dev/null +++ b/vendor/github.com/matterbridge/gozulipbot/README.md @@ -0,0 +1,20 @@ +## GoZulipBot + +`gozulipbot` is a library to interact with Zulip in Go. +It is primarily targeted toward making bots. + +## Installation + +`go get github.com/ifo/gozulipbot` + +## Usage + +Make sure to add `gozulipbot` to your imports: + +```go +import ( + gzb "github.com/ifo/gozulipbot" +) +``` + +Check out the examples directory for more info. diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/.gitignore b/vendor/github.com/matterbridge/logrus-prefixed-formatter/.gitignore new file mode 100644 index 00000000..450aeaa9 --- /dev/null +++ b/vendor/github.com/matterbridge/logrus-prefixed-formatter/.gitignore @@ -0,0 +1,34 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +# IDEA files +.idea +*.iml + +# OS X +.DS_Store + +# Unit testing +*.coverprofile diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/.travis.yml b/vendor/github.com/matterbridge/logrus-prefixed-formatter/.travis.yml new file mode 100644 index 00000000..0c80b19a --- /dev/null +++ b/vendor/github.com/matterbridge/logrus-prefixed-formatter/.travis.yml @@ -0,0 +1,14 @@ +language: go + +go: + - 1.5 + - 1.6 + - 1.7 + +install: + - make deps + +script: + - make test + +sudo: false diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/Makefile b/vendor/github.com/matterbridge/logrus-prefixed-formatter/Makefile new file mode 100644 index 00000000..70c028cc --- /dev/null +++ b/vendor/github.com/matterbridge/logrus-prefixed-formatter/Makefile @@ -0,0 +1,19 @@ +NAME=logrus-prefixed-formatter +PACKAGES=$(shell go list ./...) + +deps: + @echo "--> Installing dependencies" + @go get -d -v -t ./... + +test-deps: + @which ginkgo 2>/dev/null ; if [ $$? -eq 1 ]; then \ + go get -u -v github.com/onsi/ginkgo/ginkgo; \ + fi + +test: test-deps + @echo "--> Running tests" + @ginkgo -r --randomizeAllSpecs --randomizeSuites --failOnPending --cover --trace --race + +format: + @echo "--> Running go fmt" + @go fmt $(PACKAGES) diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/README.md b/vendor/github.com/matterbridge/logrus-prefixed-formatter/README.md new file mode 100644 index 00000000..cf10f270 --- /dev/null +++ b/vendor/github.com/matterbridge/logrus-prefixed-formatter/README.md @@ -0,0 +1,116 @@ +# Logrus Prefixed Log Formatter +[![Build Status](https://travis-ci.org/x-cray/logrus-prefixed-formatter.svg?branch=master)](https://travis-ci.org/x-cray/logrus-prefixed-formatter) + +[Logrus](https://github.com/sirupsen/logrus) formatter mainly based on original `logrus.TextFormatter` but with slightly +modified colored output and support for log entry prefixes, e.g. message source followed by a colon. In addition, custom +color themes are supported. + +![Formatter screenshot](http://cl.ly/image/1w0B3F233F3z/formatter-screenshot@2x.png) + +Just like with the original `logrus.TextFormatter` when a TTY is not attached, the output is compatible with the +[logfmt](http://godoc.org/github.com/kr/logfmt) format: + +```text +time="Oct 27 00:44:26" level=debug msg="Started observing beach" animal=walrus number=8 +time="Oct 27 00:44:26" level=info msg="A group of walrus emerges from the ocean" animal=walrus size=10 +time="Oct 27 00:44:26" level=warning msg="The group's number increased tremendously!" number=122 omg=true +time="Oct 27 00:44:26" level=debug msg="Temperature changes" temperature=-4 +time="Oct 27 00:44:26" level=panic msg="It's over 9000!" animal=orca size=9009 +time="Oct 27 00:44:26" level=fatal msg="The ice breaks!" number=100 omg=true +exit status 1 +``` + +## Installation +To install formatter, use `go get`: + +```sh +$ go get github.com/x-cray/logrus-prefixed-formatter +``` + +## Usage +Here is how it should be used: + +```go +package main + +import ( + "github.com/sirupsen/logrus" + prefixed "github.com/x-cray/logrus-prefixed-formatter" +) + +var log = logrus.New() + +func init() { + log.Formatter = new(prefixed.TextFormatter) + log.Level = logrus.DebugLevel +} + +func main() { + log.WithFields(logrus.Fields{ + "prefix": "main", + "animal": "walrus", + "number": 8, + }).Debug("Started observing beach") + + log.WithFields(logrus.Fields{ + "prefix": "sensor", + "temperature": -4, + }).Info("Temperature changes") +} +``` + +## API +`prefixed.TextFormatter` exposes the following fields and methods. + +### Fields + +* `ForceColors bool` — set to true to bypass checking for a TTY before outputting colors. +* `DisableColors bool` — force disabling colors. For a TTY colors are enabled by default. +* `DisableUppercase bool` — set to true to turn off the conversion of the log level names to uppercase. +* `ForceFormatting bool` — force formatted layout, even for non-TTY output. +* `DisableTimestamp bool` — disable timestamp logging. Useful when output is redirected to logging system that already adds timestamps. +* `FullTimestamp bool` — enable logging the full timestamp when a TTY is attached instead of just the time passed since beginning of execution. +* `TimestampFormat string` — timestamp format to use for display when a full timestamp is printed. +* `DisableSorting bool` — the fields are sorted by default for a consistent output. For applications that log extremely frequently and don't use the JSON formatter this may not be desired. +* `QuoteEmptyFields bool` — wrap empty fields in quotes if true. +* `QuoteCharacter string` — can be set to the override the default quoting character `"` with something else. For example: `'`, or `` ` ``. +* `SpacePadding int` — pad msg field with spaces on the right for display. The value for this parameter will be the size of padding. Its default value is zero, which means no padding will be applied. + +### Methods + +#### `SetColorScheme(colorScheme *prefixed.ColorScheme)` + +Sets an alternative color scheme for colored output. `prefixed.ColorScheme` struct supports the following fields: +* `InfoLevelStyle string` — info level style. +* `WarnLevelStyle string` — warn level style. +* `ErrorLevelStyle string` — error style. +* `FatalLevelStyle string` — fatal level style. +* `PanicLevelStyle string` — panic level style. +* `DebugLevelStyle string` — debug level style. +* `PrefixStyle string` — prefix style. +* `TimestampStyle string` — timestamp style. + +Color styles should be specified using [mgutz/ansi](https://github.com/mgutz/ansi#style-format) style syntax. For example, here is the default theme: + +```go +InfoLevelStyle: "green", +WarnLevelStyle: "yellow", +ErrorLevelStyle: "red", +FatalLevelStyle: "red", +PanicLevelStyle: "red", +DebugLevelStyle: "blue", +PrefixStyle: "cyan", +TimestampStyle: "black+h" +``` + +It's not necessary to specify all colors when changing color scheme if you want to change just specific ones: + +```go +formatter.SetColorScheme(&prefixed.ColorScheme{ + PrefixStyle: "blue+b", + TimestampStyle: "white+h", +}) +``` + +# License +MIT diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/basic.go b/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/basic.go deleted file mode 100644 index 2a42cb43..00000000 --- a/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/basic.go +++ /dev/null @@ -1,59 +0,0 @@ -package main - -import ( - "github.com/sirupsen/logrus" - prefixed "github.com/x-cray/logrus-prefixed-formatter" -) - -var log = logrus.New() - -func init() { - formatter := new(prefixed.TextFormatter) - log.Formatter = formatter - log.Level = logrus.DebugLevel -} - -func main() { - defer func() { - err := recover() - if err != nil { - // Fatal message - log.WithFields(logrus.Fields{ - "omg": true, - "number": 100, - }).Fatal("[main] The ice breaks!") - } - }() - - // You could either provide a map key called `prefix` to add prefix - log.WithFields(logrus.Fields{ - "prefix": "main", - "animal": "walrus", - "number": 8, - }).Debug("Started observing beach") - - // Or you can simply add prefix in square brackets within message itself - log.WithFields(logrus.Fields{ - "animal": "walrus", - "size": 10, - }).Debug("[main] A group of walrus emerges from the ocean") - - // Warning message - log.WithFields(logrus.Fields{ - "omg": true, - "number": 122, - }).Warn("[main] The group's number increased tremendously!") - - // Information message - log.WithFields(logrus.Fields{ - "prefix": "sensor", - "temperature": -4, - }).Info("Temperature changes") - - // Panic message - log.WithFields(logrus.Fields{ - "prefix": "sensor", - "animal": "orca", - "size": 9009, - }).Panic("It's over 9000!") -} diff --git a/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/themes.go b/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/themes.go deleted file mode 100644 index 6c911aea..00000000 --- a/vendor/github.com/matterbridge/logrus-prefixed-formatter/examples/themes.go +++ /dev/null @@ -1,48 +0,0 @@ -package main - -import ( - "github.com/sirupsen/logrus" - prefixed "github.com/x-cray/logrus-prefixed-formatter" -) - -var log = logrus.New() - -func init() { - formatter := new(prefixed.TextFormatter) - formatter.FullTimestamp = true - - // Set specific colors for prefix and timestamp - formatter.SetColorScheme(&prefixed.ColorScheme{ - PrefixStyle: "blue+b", - TimestampStyle: "white+h", - }) - - log.Formatter = formatter - log.Level = logrus.DebugLevel -} - -func main() { - log.WithFields(logrus.Fields{ - "prefix": "main", - "animal": "walrus", - "number": 8, - }).Debug("Started observing beach") - - // Or you can simply add prefix in square brackets within message itself - log.WithFields(logrus.Fields{ - "animal": "walrus", - "size": 10, - }).Debug("[main] A group of walrus emerges from the ocean") - - // Warning message - log.WithFields(logrus.Fields{ - "omg": true, - "number": 122, - }).Warn("[main] The group's number increased tremendously!") - - // Information message - log.WithFields(logrus.Fields{ - "prefix": "sensor", - "temperature": -4, - }).Info("Temperature changes") -} |