-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
39 lines (30 loc) · 693 Bytes
/
Copy pathmain.go
File metadata and controls
39 lines (30 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"net/http"
"os"
"pixelate/app"
"pixelate/app/client/telegram"
"pixelate/app/handler"
"pixelate/app/storage/img"
)
const (
host = "api.telegram.org"
storageDirPath = "./img/"
)
func main() {
var token = os.Getenv("TOKEN")
var port = os.Getenv("PORT")
tgClient := telegram.NewClient(host, token)
storage := img.NewStorage(storageDirPath)
if err := storage.Init(); err != nil {
panic("Could not initiate storage: " + err.Error())
}
fmt.Println("Storage initiated successfuly!")
handler := handler.NewUpdateHandler(tgClient, storage)
server := &http.Server{
Addr: ":" + port,
}
app := app.NewApp(server, handler)
app.Run()
}