prefix + no response
This commit is contained in:
parent
059fa78e32
commit
aff89d36c9
@ -44,6 +44,7 @@ telegram:
|
|||||||
key:
|
key:
|
||||||
admins:
|
admins:
|
||||||
- 93847124
|
- 93847124
|
||||||
|
prefix: "Crisp chat 1"
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
10
main.go
10
main.go
@ -96,6 +96,8 @@ func sendMsgToAdmins(text string, WebsiteID string, SessionID string) {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
config = utils.GetConfig()
|
config = utils.GetConfig()
|
||||||
|
|
||||||
|
chat_prefix = config.GetString("prefix")
|
||||||
|
|
||||||
log.Printf("Initializing Redis...")
|
log.Printf("Initializing Redis...")
|
||||||
|
|
||||||
@ -144,19 +146,19 @@ func init() {
|
|||||||
|
|
||||||
// Register handler on 'message:send/text' namespace
|
// Register handler on 'message:send/text' namespace
|
||||||
reg.On("message:send/text", func(evt crisp.EventsReceiveTextMessage) {
|
reg.On("message:send/text", func(evt crisp.EventsReceiveTextMessage) {
|
||||||
text := fmt.Sprintf(`*%s(%s): *%s`, *evt.User.Nickname, *evt.User.UserID, *evt.Content)
|
text := fmt.Sprintf(`(%s) *%s(%s): *%s`, chat_prefix, *evt.User.Nickname, *evt.User.UserID, *evt.Content)
|
||||||
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Register handler on 'message:send/file' namespace
|
// Register handler on 'message:send/file' namespace
|
||||||
reg.On("message:send/file", func(evt crisp.EventsReceiveFileMessage) {
|
reg.On("message:send/file", func(evt crisp.EventsReceiveFileMessage) {
|
||||||
text := fmt.Sprintf(`*%s(%s): *[File](%s)`, *evt.User.Nickname, *evt.User.UserID, evt.Content.URL)
|
text := fmt.Sprintf(`(%s) *%s(%s): *[File](%s)`, chat_prefix, *evt.User.Nickname, *evt.User.UserID, evt.Content.URL)
|
||||||
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Register handler on 'message:send/animation' namespace
|
// Register handler on 'message:send/animation' namespace
|
||||||
reg.On("message:send/animation", func(evt crisp.EventsReceiveAnimationMessage) {
|
reg.On("message:send/animation", func(evt crisp.EventsReceiveAnimationMessage) {
|
||||||
text := fmt.Sprintf(`*%s(%s): *[Animation](%s)`, *evt.User.Nickname, *evt.User.UserID, evt.Content.URL)
|
text := fmt.Sprintf(`(%s) *%s(%s): *[Animation](%s)`, chat_prefix, *evt.User.Nickname, *evt.User.UserID, evt.Content.URL)
|
||||||
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -195,7 +197,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if contains(config.Get("admins").([]interface{}), int64(update.Message.From.ID)) {
|
if contains(config.Get("admins").([]interface{}), int64(update.Message.From.ID)) {
|
||||||
replyToUser(&update)
|
// replyToUser(&update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user