Compare commits
No commits in common. "master" and "v0.0.53" have entirely different histories.
|
@ -1,24 +0,0 @@
|
||||||
VERSION = $(shell git describe --tags)
|
|
||||||
GUIVERSION = $(shell git describe --tags)
|
|
||||||
BUILDTIME = $(shell date +%s)
|
|
||||||
|
|
||||||
all: vet build
|
|
||||||
|
|
||||||
build: goimports
|
|
||||||
GO111MODULE=off go build \
|
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
|
||||||
|
|
||||||
vet:
|
|
||||||
GO111MODULE=off go vet
|
|
||||||
|
|
||||||
goimports:
|
|
||||||
goimports -w *.go
|
|
||||||
# // to globally reset paths:
|
|
||||||
# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go
|
|
||||||
|
|
||||||
install: goimports
|
|
||||||
GO111MODULE=off go install \
|
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
|
||||||
|
|
||||||
force: build
|
|
||||||
./go-clone-test --force
|
|
|
@ -1,12 +0,0 @@
|
||||||
//go:generate go run doc/generate.go
|
|
||||||
//go:generate go run misc/completion/generate.go
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/git-bug/git-bug/commands"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
commands.Execute()
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bufio"
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
const RWhoisPort = "4321"
|
|
||||||
|
|
||||||
func handleConnection(conn net.Conn) {
|
|
||||||
defer conn.Close()
|
|
||||||
|
|
||||||
reader := bufio.NewReader(conn)
|
|
||||||
query, err := reader.ReadString('\n')
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Error reading query: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
query = strings.TrimSpace(query)
|
|
||||||
log.Printf("Received query: %s", query)
|
|
||||||
|
|
||||||
// In a real RWhois server, you would parse the query,
|
|
||||||
// look up data, and potentially issue referrals.
|
|
||||||
// For this example, we'll send a simple response.
|
|
||||||
response := fmt.Sprintf("RWhois response for: %s\n", query)
|
|
||||||
_, err = conn.Write([]byte(response))
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Error writing response: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
listener, err := net.Listen("tcp", ":"+RWhoisPort)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Error listening: %v", err)
|
|
||||||
}
|
|
||||||
defer listener.Close()
|
|
||||||
|
|
||||||
log.Printf("RWhois server listening on port %s", RWhoisPort)
|
|
||||||
|
|
||||||
for {
|
|
||||||
conn, err := listener.Accept()
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Error accepting connection: %v", err)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
go handleConnection(conn)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
TOKEN=5292519055:AAGJPrxYs70PoIWEvLcS3oV3XZ2ldko-M4k
|
|
|
@ -1,5 +0,0 @@
|
||||||
run:
|
|
||||||
go run -v -x send_after.go
|
|
||||||
|
|
||||||
test:
|
|
||||||
curl https://api.telegram.org/bot5292519055:AAGJPrxYs70PoIWEvLcS3oV3XZ2ldko-M4k/getMe
|
|
|
@ -1,37 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
. "github.com/enetx/g"
|
|
||||||
"github.com/enetx/tg/bot"
|
|
||||||
"github.com/enetx/tg/ctx"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("started...")
|
|
||||||
// Read the bot token from the .env file
|
|
||||||
token := NewFile(".env").Read().Ok().Trim().Split("=").Collect().Last().Some()
|
|
||||||
b := bot.New(token).Build().Unwrap()
|
|
||||||
|
|
||||||
// Register a command handler for /start
|
|
||||||
b.Command("start", func(ctx *ctx.Context) error {
|
|
||||||
// Send an immediate message so Telegram considers the update as "handled"
|
|
||||||
ctx.SendMessage("Preparing self-destruct...").Send()
|
|
||||||
|
|
||||||
// Schedule a second message to be sent after 3 seconds,
|
|
||||||
// and automatically delete it 5 seconds after it is sent
|
|
||||||
ctx.SendMessage("This message will self-destruct in 5 seconds.").
|
|
||||||
After(3 * time.Second). // Delay sending by 3 seconds
|
|
||||||
DeleteAfter(5 * time.Second). // Delete 5 seconds after it is sent
|
|
||||||
Send()
|
|
||||||
|
|
||||||
// Delete the original /start message (from the user)
|
|
||||||
// This should be done after responding to avoid Telegram resending the update
|
|
||||||
return ctx.DeleteMessage().Send().Err()
|
|
||||||
})
|
|
||||||
|
|
||||||
// Start polling for updates and drop any pending ones from before startup
|
|
||||||
b.Polling().DropPendingUpdates().Start()
|
|
||||||
}
|
|
Loading…
Reference in New Issue