|
@@ -9,14 +9,25 @@ import (
|
|
|
"gogs.daxia.dev/huanan/pkg.daxia.dev/event2"
|
|
|
)
|
|
|
|
|
|
+var deleteMsgList = make([]tgbotapi.DeleteMessageConfig, 0)
|
|
|
+
|
|
|
func StartGameTimer() {
|
|
|
waitSecond := viper.GetInt("wait_second")
|
|
|
- for {
|
|
|
- logrus.Info("run...")
|
|
|
- sendGameInfo()
|
|
|
- sendGameInfo2()
|
|
|
- <-time.After(time.Duration(waitSecond) * time.Second)
|
|
|
- }
|
|
|
+ go func() {
|
|
|
+ for {
|
|
|
+ logrus.Info("run...")
|
|
|
+ sendGameInfo()
|
|
|
+ <-time.After(time.Duration(waitSecond) * time.Second)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ go func() {
|
|
|
+ for {
|
|
|
+ logrus.Info("run...")
|
|
|
+ sendGameInfo2()
|
|
|
+ <-time.After(60 * time.Second)
|
|
|
+ }
|
|
|
+ }()
|
|
|
}
|
|
|
|
|
|
func sendGameInfo() {
|
|
@@ -46,35 +57,79 @@ func sendGameInfo() {
|
|
|
}
|
|
|
|
|
|
func sendGameInfo2() {
|
|
|
+ chatID2 := int64(-1001632614756)
|
|
|
+
|
|
|
+ if len(deleteMsgList) == 2 {
|
|
|
+ MainBot.botApi.Send(deleteMsgList[0])
|
|
|
+
|
|
|
+ <-time.After(1 * time.Second)
|
|
|
+
|
|
|
+ MainBot.botApi.Send(deleteMsgList[1])
|
|
|
+ }
|
|
|
+
|
|
|
+ deleteMsgList = make([]tgbotapi.DeleteMessageConfig, 0)
|
|
|
+
|
|
|
caption := `东方汇看牌抢庄牛牛积分房,每天最高免费赠送2000U,详情请看牛牛群置顶规则。下载APP,大于100流水赠送5U。分享下级,下级注册赠送1U,上级推广奖励0.5U
|
|
|
|
|
|
|
|
|
<a href='https://t.me/FLLDFH'>每天500流水免费领取60U</a>
|
|
|
`
|
|
|
- chatID2 := int64(-1001632614756)
|
|
|
|
|
|
- textMsg := tgbotapi.MessageConfig{
|
|
|
- BaseChat: tgbotapi.BaseChat{
|
|
|
- ChatID: chatID2,
|
|
|
- },
|
|
|
- Text: caption,
|
|
|
- ParseMode: "HTML",
|
|
|
- DisableWebPagePreview: true,
|
|
|
+ {
|
|
|
+ textMsg := tgbotapi.MessageConfig{
|
|
|
+ BaseChat: tgbotapi.BaseChat{
|
|
|
+ ChatID: chatID2,
|
|
|
+ },
|
|
|
+ Text: caption,
|
|
|
+ ParseMode: "HTML",
|
|
|
+ DisableWebPagePreview: true,
|
|
|
+ }
|
|
|
+
|
|
|
+ resp, err := MainBot.botApi.Send(textMsg)
|
|
|
+ if err != nil {
|
|
|
+ logrus.Error(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ deleteMsgList = append(deleteMsgList, tgbotapi.DeleteMessageConfig{
|
|
|
+ ChatID: resp.Chat.ID,
|
|
|
+ MessageID: resp.MessageID,
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
- event2.MustFire(EventSendMsg, tgbotapi.Chattable(textMsg))
|
|
|
-
|
|
|
<-time.After(2 * time.Second)
|
|
|
|
|
|
- gifMsg := &tgbotapi.GameConfig{
|
|
|
- BaseChat: tgbotapi.BaseChat{
|
|
|
- ChatID: chatID2,
|
|
|
- ReplyMarkup: GetGameReplyMarkup2(),
|
|
|
- },
|
|
|
- GameShortName: "qznn",
|
|
|
+ {
|
|
|
+ gifMsg := &tgbotapi.GameConfig{
|
|
|
+ BaseChat: tgbotapi.BaseChat{
|
|
|
+ ChatID: chatID2,
|
|
|
+ ReplyMarkup: GetGameReplyMarkup2(),
|
|
|
+ },
|
|
|
+ GameShortName: "qznn",
|
|
|
+ }
|
|
|
+
|
|
|
+ resp, err := MainBot.botApi.Send(gifMsg)
|
|
|
+ if err != nil {
|
|
|
+ logrus.Error(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ deleteMsgList = append(deleteMsgList, tgbotapi.DeleteMessageConfig{
|
|
|
+ ChatID: resp.Chat.ID,
|
|
|
+ MessageID: resp.MessageID,
|
|
|
+ })
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- event2.MustFire(EventSendMsg, tgbotapi.Chattable(gifMsg))
|
|
|
+func GetGameReplyMarkupSimple() tgbotapi.InlineKeyboardMarkup {
|
|
|
+ gameBtn := tgbotapi.NewInlineKeyboardButtonData("🎮进入游戏", "")
|
|
|
+ gameBtn.CallbackGame = &tgbotapi.CallbackGame{}
|
|
|
+ gameBtn.CallbackData = nil
|
|
|
+
|
|
|
+ return tgbotapi.NewInlineKeyboardMarkup(
|
|
|
+ tgbotapi.NewInlineKeyboardRow(
|
|
|
+ gameBtn,
|
|
|
+ ),
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
func GetGameReplyMarkup() tgbotapi.InlineKeyboardMarkup {
|