Initial Commit
This commit is contained in:
36
examples/replybot/main.go
Normal file
36
examples/replybot/main.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"go.elara.ws/salix"
|
||||
)
|
||||
|
||||
//go:embed replybot.salix.txt
|
||||
var tmpl string
|
||||
|
||||
var matches = [][]string{
|
||||
{"https://i.imgur.com/aaaaaaa.jpg", "aaaaaaa.jpg"},
|
||||
{"https://imgur.com/a/bbbbbbb.jpg", "a/bbbbbbb.jpg"},
|
||||
}
|
||||
|
||||
func main() {
|
||||
vars := map[string]any{
|
||||
"type": "post",
|
||||
"matches": matches,
|
||||
}
|
||||
|
||||
t, err := salix.New().
|
||||
WithVarMap(vars).
|
||||
ParseString("replybot.salix.txt", tmpl)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
err = t.Execute(os.Stdout)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
8
examples/replybot/replybot.salix.txt
Normal file
8
examples/replybot/replybot.salix.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
#if(len(matches) > 1):Imgur links were#else:An Imgur link was#!if detected in your #(type). Here are links to the same #if(len(matches) > 1):locations#else:location#!if on alternative frontends that protect your privacy.
|
||||
#for(i, match in matches):
|
||||
#if(len(matches) > 1):Link #(i+1):#!if
|
||||
- [imgur.artemislena.eu](https://imgur.artemislena.eu/#(match[1]))
|
||||
- [rimgo.projectsegfau.lt](https://rimgo.projectsegfau.lt/#(match[1]))
|
||||
- [imgin.voidnet.tech](https://imgin.voidnet.tech/#(match[1]))
|
||||
|
||||
#!for
|
||||
Reference in New Issue
Block a user