update botnest
This commit is contained in:
parent
44b3c939f8
commit
c444a970a2
45
main.go
45
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)
|
||||
|
Loading…
Reference in New Issue
Block a user