Skip to content

About

Buzz (Nostr NIP-29) bot that compiles and runs code snippets posted with /run via paiza.io and replies with the output

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

buzz-runbot

A Buzz bot that compiles and runs code snippets via paiza.io and replies with the output. It connects to a Buzz relay directly over Nostr (NIP-29 group chat, NIP-42 auth).

Usage

Post a message containing a /run command in the group the bot is watching. All of these forms are accepted:

/run go
package main

import "fmt"

func main() {
    fmt.Println("hello, buzz")
}
/run go
```
package main
...
```
/run
```go
package main
...
```

The bot replies in the same group with the program's output. To see the list of supported languages, post:

/run list

To re-execute a previous /run, reply to the bot's output (or anywhere in the thread) with:

/rerun

The bot walks the reply chain up to the original /run command and runs it again.

Supported languages

rb/ruby, py/python/python3, py2/python2, go, js/node/javascript, ts/typescript, coffee/coffeescript, c, cpp/c++, objc/objective-c, cs/c#/csharp, fs/f#/fsharp, vb, java, kt/kotlin, scala, rs/rust, d, sh/bash, php, pl/perl, swift, hs/haskell, erl/erlang, ex/elixir, clj/clojure, lisp/cl/commonlisp, scheme/scm, r, cobol, mysql, nadesiko, bf/brainfuck, text/plain

Post /run list for the authoritative list.

Installation

go install github.com/mattn/buzz-runbot@latest

Or with Docker:

docker build -t buzz-runbot .
docker run -e BOT_NSEC=nsec1... buzz-runbot -group '#general'

Configuration

The bot's private key is read from the BOT_NSEC environment variable (nsec or hex). The key must be a member of the Buzz community.

BOT_NSEC=nsec1... buzz-runbot [options]
Flag Default Description
-relay wss://vim-jp.communities.buzz.xyz relay URL
-group (empty) group id (UUID) or #name; empty watches every room the bot is a member of, following invites and removals live (kinds 39002/9000/9001)
-endpoint (empty) forward events to a nostr-runbot HTTP endpoint instead of calling paiza.io directly
-backlog 1h on startup, answer /run commands up to this old that have no reply yet (double replies are avoided by checking for an existing bot reply)

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

About

Buzz (Nostr NIP-29) bot that compiles and runs code snippets posted with /run via paiza.io and replies with the output

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages