initiate withdrawal
This commit is contained in:
parent
01ef73c11d
commit
36382d6f11
50
bot.go
50
bot.go
@ -34,6 +34,7 @@ func BotHandlers(b *tb.Bot) {
|
|||||||
|
|
||||||
b.Handle("/g_stock", botGStock)
|
b.Handle("/g_stock", botGStock)
|
||||||
b.Handle("/g_deposit_all", botGDepositAll)
|
b.Handle("/g_deposit_all", botGDepositAll)
|
||||||
|
b.Handle("/g_withdraw", botGWithdraw)
|
||||||
b.Handle("/save_res", botSaveRes)
|
b.Handle("/save_res", botSaveRes)
|
||||||
|
|
||||||
b.Handle("/backup_export", botBackupExport)
|
b.Handle("/backup_export", botBackupExport)
|
||||||
@ -716,6 +717,55 @@ func botGDepositAll(m *tb.Message) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func botGWithdraw(m *tb.Message) {
|
||||||
|
if !m.Private() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
p := JobPayloadGWithdraw{
|
||||||
|
MsgID64: int64(m.ID),
|
||||||
|
ChatID64: m.Chat.ID,
|
||||||
|
items: nil,
|
||||||
|
Status: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
r := regexp.MustCompile("^(( )*[a-z0-9]+ [0-9]+( )*)+$")
|
||||||
|
for _, l := range r.FindAllStringSubmatch(m.Payload, -1) {
|
||||||
|
fmt.Print("%v\n", l)
|
||||||
|
/*
|
||||||
|
i := getObjItemID(``, l[1])
|
||||||
|
q, _ := strconv.ParseInt(l[2], 10, 64)
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
ChatWarsItems
|
||||||
|
b, _ := json.Marshal(p)
|
||||||
|
t := time.Now().UTC()
|
||||||
|
_, err := createJob(objSubTypeJobGDeposit, objJobPriority, int64(m.Chat.ID), 0, t, b)
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
if false {
|
||||||
|
c := TGCommand{
|
||||||
|
Type: commandReplyMsg,
|
||||||
|
Text: fmt.Sprintf("%s", err),
|
||||||
|
FromMsgID64: int64(m.ID),
|
||||||
|
FromChatID64: m.Chat.ID,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- c
|
||||||
|
} else {
|
||||||
|
c := TGCommand{
|
||||||
|
Type: commandReplyMsg,
|
||||||
|
Text: "Withdrawal started",
|
||||||
|
FromMsgID64: int64(m.ID),
|
||||||
|
FromChatID64: m.Chat.ID,
|
||||||
|
}
|
||||||
|
TGCmdQueue <- c
|
||||||
|
}
|
||||||
|
|
||||||
|
//log.Printf("botGDepositAll : json : %s\n", string(b))
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func botTimer(m *tb.Message) {
|
func botTimer(m *tb.Message) {
|
||||||
if !m.Private() {
|
if !m.Private() {
|
||||||
return
|
return
|
||||||
|
7
def.go
7
def.go
@ -293,6 +293,13 @@ type JobPayloadGStock struct {
|
|||||||
ChatID64 int64 `json:"chat_id"`
|
ChatID64 int64 `json:"chat_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type JobPayloadGWithdraw struct {
|
||||||
|
MsgID64 int64 `json:"msg_id"`
|
||||||
|
ChatID64 int64 `json:"chat_id"`
|
||||||
|
Items []ChatWarsItems `json:"items"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
type JobPayloadGDeposit struct {
|
type JobPayloadGDeposit struct {
|
||||||
MsgID64 int64 `json:"msg_id"`
|
MsgID64 int64 `json:"msg_id"`
|
||||||
ChatID64 int64 `json:"chat_id"`
|
ChatID64 int64 `json:"chat_id"`
|
||||||
|
Loading…
Reference in New Issue
Block a user