Skip to content

GopherCord is a set of Go packages designed to aid in interacting with the CipherCord API from Go.

License

Notifications You must be signed in to change notification settings

ciphercord/gophercord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caution

Anyone can interact with the CipherCord API. Please sanitize responses to avoid errors and possible hijacking attempts.

GopherCord

MIT License Go Report Card

GopherCord is a set of Go packages designed to aid in interacting with the CipherCord API from Go.

Example

// simple message net
package main

import (
	"fmt"
	"log"

	ccbot "github.com/ciphercord/gophercord/bot"
	ccmsg "github.com/ciphercord/gophercord/message"
)

func main() {
	if err := ccbot.Init(); err != nil {
		log.Fatal(err)
	}

	for {
		data := <-ccbot.Messages

		umsg, err := ccmsg.Unpackage(data, "MyPrivateKey")
		if err == ccmsg.ErrUnmatched {
			continue
		} else if err != nil {
			log.Fatal(err)
		}

		fmt.Printf("%s: %s\n", umsg.Author, umsg.Content)
	}
}