jheuel / pollrBot

Telegram bot that can create inline poll messages
MIT License
14 stars 6 forks source link

Files are missing #8

Open cleanfuzz opened 11 months ago

cleanfuzz commented 11 months ago

I can't find the files asset-manifest.json, service-worker.js mentioned in main.go.

    // static files
    staticFiles := []string{
        "favicon.ico",
        "manifest.json",
        "asset-manifest.json",
        "robots.txt",
        "service-worker.js",
        "logo192.png",
        "logo512.png",
        "index.html",
    }

Also no */static directory (in main.go), I had to create it manually by copying existing files. But I'm not sure I get files that you ment in */static directory.

    for _, staticFile := range staticFiles {
        f := fmt.Sprintf("/%s", staticFile)
        http.Handle(f, serveStatic("/home/jheuel/services/pollrBot/static/"+f))
    }
    http.Handle("/", serveStatic("/home/jheuel/services/pollrBot/static/index.html"))

    http.HandleFunc("/poll/", pollHandler(st))
    http.Handle("/messageme/", contactHandler(bot))

    fs := http.FileServer(http.Dir("/home/jheuel/services/pollrBot/static/static"))
    http.Handle("/static/", http.StripPrefix("/static/", fs))

The function below returns an error:

    info, err := bot.GetWebhookInfo()
    if err != nil {
        log.Fatal(err)
    }
    if info.LastErrorDate != 0 {
        log.Printf("Telegram callback failed: %s", info.LastErrorMessage)
    }

Error:

Telegram callback failed: Connection refused

I guess I'm getting an error due to missing and/or incorrect files. The port specified for the Telegram webhook is forwarded.

jheuel commented 11 months ago

You need to build the react frontend (see the readme in the frontend directory), which will create the files that you are missing. Then you can change the hard coded path in the go code to where your static files are.

But your error looks more like an incorrect telegram bot token.