This commit is contained in:
shoopea 2019-10-12 13:29:15 +08:00
parent 444d911691
commit a87baa28d3

10
td.go
View File

@ -39,8 +39,8 @@ func ListenMQ(c *tdlib.Client, msgs <-chan TGCommand) {
func ListenTG(c *tdlib.Client) { func ListenTG(c *tdlib.Client) {
eventFilter := func(msg *tdlib.TdMessage) bool { eventFilter := func(msg *tdlib.TdMessage) bool {
updateMsg := (*msg).(*tdlib.UpdateNewMessage) updateMsg := (*msg).(*tdlib.UpdateNewMessage)
chatID := updateMsg.Message.ChatID chatID := int64(updateMsg.Message.ChatID)
userID := updateMsg.Message.SenderUserID userID := int64(updateMsg.Message.SenderUserID)
forwardInfo := updateMsg.Message.ForwardInfo forwardInfo := updateMsg.Message.ForwardInfo
for k, v := range cfg.Listen { for k, v := range cfg.Listen {
if (v.Chat == chatID || v.Chat == 0) && if (v.Chat == chatID || v.Chat == 0) &&
@ -95,11 +95,7 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
var chat int64 var chat int64
var m ChatWarsMessage var m ChatWarsMessage
if *chatID64 == 0 { chat = *chatID64
chat = user_chtwrsbot
} else {
chat = *chatID64
}
if *senderUserID64 != 0 { if *senderUserID64 != 0 {
userDetails, err := c.GetUser(int32(*senderUserID64)) userDetails, err := c.GetUser(int32(*senderUserID64))