Update "/notice"
This commit is contained in:
parent
b2c937c502
commit
0deaeaa2cc
@ -47,6 +47,7 @@ Linux:
|
||||
|
||||
```bash
|
||||
screen -S e5sub
|
||||
chmod 773 e5sub
|
||||
./e5sub
|
||||
(Ctrl A+D)
|
||||
```
|
||||
|
||||
@ -114,6 +114,10 @@ func bOnText(m *tb.Message) {
|
||||
}
|
||||
case USWillBind:
|
||||
{
|
||||
if !m.IsReply() {
|
||||
bot.Send(m.Chat, "请通过回复方式绑定")
|
||||
return
|
||||
}
|
||||
if GetBindNum(m.Chat.ID) == BindMaxNum {
|
||||
bot.Send(m.Chat, "已经达到最大可绑定数")
|
||||
return
|
||||
@ -129,3 +133,7 @@ func bOnText(m *tb.Message) {
|
||||
}
|
||||
}
|
||||
}
|
||||
func bNotice(m *tb.Message) {
|
||||
viper.ReadInConfig()
|
||||
bot.Send(m.Chat, viper.GetString("notice"))
|
||||
}
|
||||
|
||||
16
main.go
16
main.go
@ -44,9 +44,19 @@ func init() {
|
||||
Socks5 = viper.GetString("socks5")
|
||||
//set bot
|
||||
fmt.Println("Bot Settings……")
|
||||
Poller := &tb.LongPoller{Timeout: 15 * time.Second}
|
||||
spamProtected := tb.NewMiddlewarePoller(Poller, func(upd *tb.Update) bool {
|
||||
if upd.Message == nil {
|
||||
return true
|
||||
}
|
||||
if !upd.Message.Private() {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
botsettings := tb.Settings{
|
||||
Token: BotToken,
|
||||
Poller: &tb.LongPoller{Timeout: 10 * time.Second},
|
||||
Poller: spamProtected,
|
||||
}
|
||||
//set socks5
|
||||
if Socks5 != "" {
|
||||
@ -72,7 +82,8 @@ func main() {
|
||||
func BotStart() {
|
||||
MakeHandle()
|
||||
TaskLaunch()
|
||||
fmt.Println("Bot Start……")
|
||||
fmt.Println("Bot Start")
|
||||
fmt.Println("------------")
|
||||
bot.Start()
|
||||
}
|
||||
func MakeHandle() {
|
||||
@ -81,6 +92,7 @@ func MakeHandle() {
|
||||
bot.Handle("/my", bMy)
|
||||
bot.Handle("/bind", bBind)
|
||||
bot.Handle("/unbind", bUnBind)
|
||||
bot.Handle("/notice", bNotice)
|
||||
bot.Handle("/help", bHelp)
|
||||
bot.Handle(tb.OnText, bOnText)
|
||||
//bot.Handle(tb.InlineButton{Unique: ""})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user