diff --git a/main.go b/main.go index da40b56..d66586e 100644 --- a/main.go +++ b/main.go @@ -32,8 +32,8 @@ type Config struct { var ( config = flag.String("config", "gocw2.cfg", "config file path") history = flag.Bool("history", false, "initialize chat history") - historyChatID64 = flag.int64("chat_id", nil, "chat to historize") - historySenderUserID64 = flag.int64("sender_user_id", nil, "sender_user_id to historize") + historyChatID64 = flag.Int64("chat_id", 0, "chat to historize") + historySenderUserID64 = flag.Int64("sender_user_id", 0, "sender_user_id to historize") cfg Config diff --git a/td.go b/td.go index 999c91e..b114296 100644 --- a/td.go +++ b/td.go @@ -72,10 +72,10 @@ func getHistory(c *tdlib.Client, chatID64 int64, senderUserID64 int64) { var msgCount int32 = 0 var lastMsgTime time.Time = time.Now() - if chatID64 == nil { - c := user_chtwrsbot + if chatID64 == 0 { + chat := user_chtwrsbot } else { - c = chatID64 + chat = chatID64 } for lastMsgID64 >= 0 {