From c444a970a2353916ba007f75eceb61aa1e9cbfae Mon Sep 17 00:00:00 2001 From: shoopea Date: Sun, 31 Jul 2022 11:14:28 +0800 Subject: [PATCH] update botnest --- main.go | 45 +-------------------------------------------- 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/main.go b/main.go index 8c7ca7e..cfb2d94 100644 --- a/main.go +++ b/main.go @@ -23,7 +23,7 @@ type ChatWarsWithdraw struct { } const user_chtwrsbot = 408101137 -const user_botnestbot = 541634211 +const user_botnestbot int64 = 5500350765 const user_chtwrscastlebot = 526586204 const chat_darkwing = -1001152534174 const chat_guild_deposit = -1001179598662 @@ -106,7 +106,6 @@ func main() { ownUserID64 = int64(OwnUserID(client)) go PillageKnight(client) - go ListenDarkwing(client) go ListenCW(client) // go ListenAll(client) go ListenGuild(client) @@ -332,48 +331,6 @@ func ListenCW(c *tdlib.Client) { } } -func ListenDarkwing(c *tdlib.Client) { - eventFilter := func(msg *tdlib.TdMessage) bool { - updateMsg := (*msg).(*tdlib.UpdateNewMessage) - chatID := updateMsg.Message.ChatID - senderUserID := updateMsg.Message.SenderUserID - if senderUserID == user_botnestbot && chatID == chat_darkwing { - return true - } - return false - } - - receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100) - for newMsg := range receiver.Chan { - updateMsg := (newMsg).(*tdlib.UpdateNewMessage) - senderUserID := updateMsg.Message.SenderUserID - mType := updateMsg.Message.Content.GetMessageContentEnum() - if mType == "messageText" { - user, err := c.GetUser(senderUserID) - if err != nil { - fmt.Println("ListenDarkwing:", err.Error()) - continue - } - txt := updateMsg.Message.Content.(*tdlib.MessageText).Text.Text - fmt.Println("============== DARKWING (", user.Username, ") =================================================================") - fmt.Println(txt, "\n") - fmt.Println("===============================================================================================================") - - for _, line := range strings.Split(strings.TrimSuffix(txt, "\n"), "\n") { - match, _ := regexp.MatchString(".*Your result on the battlefield:.*", line) - if match { - fmt.Println("!!!!!!!!!!!!!!!!! REPORT SPOTTED !!!!!!!!!!!!!!!!!") - time.Sleep(1 * time.Second) - ForwardMsg(c, updateMsg.Message.ID, updateMsg.Message.ChatID, int64(user_botnestbot)) - time.Sleep(1 * time.Second) - ForwardMsg(c, updateMsg.Message.ID, updateMsg.Message.ChatID, int64(user_chtwrscastlebot)) - break - } - } - } - } -} - func ListenGuild(c *tdlib.Client) { eventFilter := func(msg *tdlib.TdMessage) bool { updateMsg := (*msg).(*tdlib.UpdateNewMessage)