first step for automated g_deposit
This commit is contained in:
parent
c7a631a252
commit
41f02309d5
27
bot.go
27
bot.go
@ -32,6 +32,7 @@ func BotHandlers(b *tb.Bot) {
|
||||
b.Handle("/timer", botTimer)
|
||||
|
||||
b.Handle("/g_stock", botGStock)
|
||||
b.Handle("/g_deposit_all", botGDepositAll)
|
||||
|
||||
b.Handle("/backup_export", botBackupExport)
|
||||
b.Handle("/backup_import", botBackupImport)
|
||||
@ -597,6 +598,32 @@ func botGStock(m *tb.Message) {
|
||||
return
|
||||
}
|
||||
|
||||
func botGDepositAll(m *tb.Message) {
|
||||
if !m.Private() {
|
||||
return
|
||||
}
|
||||
|
||||
p := JobPayloadGDeposit{
|
||||
MsgID64: int64(m.ID),
|
||||
ChatID64: m.Chat.ID,
|
||||
}
|
||||
b, _ := json.Marshal(p)
|
||||
t := time.Now().UTC()
|
||||
_, err := createJob(objSubTypeJobGDeposit, objJobPriority, int64(m.Chat.ID), t, b)
|
||||
|
||||
if err != nil {
|
||||
c := TGCommand{
|
||||
Type: commandReplyMsg,
|
||||
Text: fmt.Sprintf("%s", err),
|
||||
FromMsgID64: int64(m.ID),
|
||||
FromChatID64: m.Chat.ID,
|
||||
}
|
||||
TGCmdQueue <- c
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func botTimer(m *tb.Message) {
|
||||
if !m.Private() {
|
||||
return
|
||||
|
6
def.go
6
def.go
@ -234,6 +234,11 @@ type JobPayloadGStock struct {
|
||||
ChatID64 int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
type JobPayloadGDeposit struct {
|
||||
MsgID64 int64 `json:"msg_id"`
|
||||
ChatID64 int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
type JobPayloadRescanMsg struct {
|
||||
Query string `json:"query"`
|
||||
MsgID64 int64 `json:"msg_id"`
|
||||
@ -377,6 +382,7 @@ const (
|
||||
objSubTypeJobMsgRefresh = 609
|
||||
objSubTypeJobBackupExport = 610
|
||||
objSubTypeJobBackupImport = 611
|
||||
objSubTypeJobGDeposit = 612
|
||||
objSubTypeItemResource = 701
|
||||
objSubTypeItemAlch = 702
|
||||
objSubTypeItemMisc = 703
|
||||
|
1
sql.go
1
sql.go
@ -494,6 +494,7 @@ func initDB() {
|
||||
,(` + strconv.Itoa(objSubTypeJobMsgRefresh) + `, "job_msg_refresh", "Refresh message from client", ` + strconv.Itoa(objTypeJob) + `)
|
||||
,(` + strconv.Itoa(objSubTypeJobBackupExport) + `, "job_backup_export", "Export Backup", ` + strconv.Itoa(objTypeJob) + `)
|
||||
,(` + strconv.Itoa(objSubTypeJobBackupImport) + `, "job_backup_import", "Import Backup", ` + strconv.Itoa(objTypeJob) + `)
|
||||
,(` + strconv.Itoa(objSubTypeJobGDeposit) + `, "job_gdeposit", "GDeposit job", ` + strconv.Itoa(objTypeJob) + `)
|
||||
,(` + strconv.Itoa(objSubTypeItemResource) + `, "item_res", "Time", ` + strconv.Itoa(objTypeItem) + `)
|
||||
,(` + strconv.Itoa(objSubTypeItemAlch) + `, "item_alch", "Time", ` + strconv.Itoa(objTypeItem) + `)
|
||||
,(` + strconv.Itoa(objSubTypeItemMisc) + `, "item_misc", "Time", ` + strconv.Itoa(objTypeItem) + `)
|
||||
|
Loading…
Reference in New Issue
Block a user