update withdrawals

This commit is contained in:
shoopea 2021-08-27 10:43:05 +08:00
parent a118dd2e30
commit 2ee882de97

65
main.go
View File

@ -410,7 +410,7 @@ func ListenGuild(c *tdlib.Client) {
for _, line := range strings.Split(strings.TrimSuffix(txt, "\n"), "\n") { for _, line := range strings.Split(strings.TrimSuffix(txt, "\n"), "\n") {
validID := regexp.MustCompile(`^/g_withdraw ([a-z0-9]+) ([0-9]+)$`) validID := regexp.MustCompile(`^/g_withdraw ([a-z0-9]+) ([0-9]+)$`)
if validID.MatchString(line) && senderUserID != 121964035 && senderUserID != 755149279 && senderUserID != 1378605 { if validID.MatchString(line) && senderUserID != 121964035 && senderUserID != 755149279 && senderUserID != 1378605 && senderUserID != 602226730 && senderUserID != 786012402 {
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GUILD WITHDRAWAL SPOTTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GUILD WITHDRAWAL SPOTTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
t := regexp.MustCompile(`/g_withdraw (?P<Code>[a-z0-9]+) (?P<Quantity>[0-9]+)`) t := regexp.MustCompile(`/g_withdraw (?P<Code>[a-z0-9]+) (?P<Quantity>[0-9]+)`)
@ -535,6 +535,69 @@ func ListenGuild(c *tdlib.Client) {
break break
} }
if validID.MatchString(line) && senderUserID == 602226730 {
t := regexp.MustCompile(`/g_withdraw (?P<Code>[a-z0-9]+) (?P<Quantity>[0-9]+)`)
if t.FindStringSubmatch(line) != nil {
size, _ = strconv.Atoi(t.ReplaceAllString(line, "${Quantity}"))
fmt.Printf("Withdrawing %s / %d\n", t.ReplaceAllString(line, "${Code}"), size)
m := ChatWarsWithdraw{
Item: t.ReplaceAllString(line, "${Code}"),
Quantity: int64(size),
UserID64: int64(senderUserID),
Time: time.Now(),
}
msgText = fmt.Sprintf("Gentle reminder that this is not edible.\n")
inputMsgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText(msgText, nil), true, true)
c.SendMessage(chat_guild, 0, false, false, nil, inputMsgTxt)
msgText = fmt.Sprintf("/g_withdraw %s %d\n", m.Item, m.Quantity)
inputMsgTxt = tdlib.NewInputMessageText(tdlib.NewFormattedText(msgText, nil), true, true)
msgMutex.Lock()
sendMsg, _ := c.SendMessage(user_chtwrsbot, 0, false, false, nil, inputMsgTxt)
msgID64 = sendMsg.ID
msgText = string("/g_withdraw")
msgUserID64 = m.UserID64
fmt.Println("send msgID64 (g_withdraw) : ", msgID64)
} else {
fmt.Printf("Can't match withdrawing request.\n")
}
break
}
if validID.MatchString(line) && senderUserID == 786012402 {
t := regexp.MustCompile(`/g_withdraw (?P<Code>[a-z0-9]+) (?P<Quantity>[0-9]+)`)
if t.FindStringSubmatch(line) != nil {
size, _ = strconv.Atoi(t.ReplaceAllString(line, "${Quantity}"))
fmt.Printf("Withdrawing %s / %d\n", t.ReplaceAllString(line, "${Code}"), size)
m := ChatWarsWithdraw{
Item: t.ReplaceAllString(line, "${Code}"),
Quantity: int64(size),
UserID64: int64(senderUserID),
Time: time.Now(),
}
msgText = fmt.Sprintf("And voila !\n")
inputMsgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText(msgText, nil), true, true)
c.SendMessage(chat_guild, 0, false, false, nil, inputMsgTxt)
msgText = fmt.Sprintf("/g_withdraw %s %d\n", m.Item, m.Quantity)
inputMsgTxt = tdlib.NewInputMessageText(tdlib.NewFormattedText(msgText, nil), true, true)
msgMutex.Lock()
sendMsg, _ := c.SendMessage(user_chtwrsbot, 0, false, false, nil, inputMsgTxt)
msgID64 = sendMsg.ID
msgText = string("/g_withdraw")
msgUserID64 = m.UserID64
fmt.Println("send msgID64 (g_withdraw) : ", msgID64)
} else {
fmt.Printf("Can't match withdrawing request.\n")
}
break
}
validID = regexp.MustCompile(`^/withdraw_([ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]{26})$`) validID = regexp.MustCompile(`^/withdraw_([ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]{26})$`)
if validID.MatchString(line) { if validID.MatchString(line) {
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GUILD WITHDRAW CONF SPOTTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GUILD WITHDRAW CONF SPOTTED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")