Skip to content

Golang sdk for hack-fan/skadi, pull jobs from server.

License

Notifications You must be signed in to change notification settings

hack-fan/skadigo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skadi Go SDK

hack-fan/skadi is a cloud message center, you can send your message/job/command to it by several ways, Slack/Teams/Wechat etc... then your agent will get it, do anything you defined, return the result.

This is golang sdk for hack-fan/skadi, pull your jobs from skadi server.

Example

Prepare your TOKEN first.

There is several example agent by our team:

You can only start one worker per TOKEN.

package main

import (
    "context"
    "fmt"
    "os/signal"
    "syscall"

    "github.com/hack-fan/skadigo"
)

func handler(id,msg string) (string, error) {
    fmt.Printf("received command message: %s %s", id, msg)
    return msg,nil
}

func main() {
    // system signals - for graceful shutdown or restart
    ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
    defer stop()

    // skadi agent
    agent := skadigo.New("YOUR-TOKEN", "https://api.letserver.run", nil)
    agent.Start(ctx, handler, 0)
}

You can use the agent for sending messages anywhere.

    agent.SendInfo("Hello World")

About

Golang sdk for hack-fan/skadi, pull jobs from server.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages