Compare commits
4 Commits
remove-for
...
master
Author | SHA1 | Date | |
---|---|---|---|
e346743cae | |||
5e83b1ace4 | |||
8b138cadda | |||
53061f1fd2 |
@ -16,4 +16,6 @@ steps:
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
branch:
|
||||
- master
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
FROM golang:alpine
|
||||
ADD . /app
|
||||
FROM golang:1.17-alpine
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN go get ; CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
|
||||
CMD ./Crisp_Telegram_bot
|
||||
CMD ["./Crisp_Telegram_bot"]
|
||||
|
||||
|
10
main.go
10
main.go
@ -16,7 +16,6 @@ import (
|
||||
var bot *tgbotapi.BotAPI
|
||||
var client *crisp.Client
|
||||
|
||||
// var redisClient *redis.Client
|
||||
var config *viper.Viper
|
||||
|
||||
// CrispMessageInfo stores the original message
|
||||
@ -49,12 +48,9 @@ func main() {
|
||||
config = utils.GetConfig()
|
||||
|
||||
var chat_prefix = config.GetString("prefix")
|
||||
|
||||
var err error
|
||||
log.Printf("Initializing Bot...")
|
||||
|
||||
bot, err = tgbotapi.NewBotAPI(config.GetString("telegram.key"))
|
||||
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
@ -84,19 +80,19 @@ func main() {
|
||||
|
||||
// Register handler on 'message:send/text' namespace
|
||||
reg.On("message:send/text", func(evt crisp.EventsReceiveTextMessage) {
|
||||
text := fmt.Sprintf(`(%s) *%s(%s): *%s`, chat_prefix, *evt.User.Nickname, *evt.User.UserID, *evt.Content)
|
||||
text := fmt.Sprintf(`%s *%s: *%s`, chat_prefix, *evt.User.Nickname, *evt.Content)
|
||||
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
||||
})
|
||||
|
||||
// Register handler on 'message:send/file' namespace
|
||||
reg.On("message:send/file", func(evt crisp.EventsReceiveFileMessage) {
|
||||
text := fmt.Sprintf(`(%s) *%s(%s): *[File](%s)`, chat_prefix, *evt.User.Nickname, *evt.User.UserID, evt.Content.URL)
|
||||
text := fmt.Sprintf(`%s *%s: *[File](%s)`, chat_prefix, *evt.User.Nickname, evt.Content.URL)
|
||||
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
||||
})
|
||||
|
||||
// Register handler on 'message:send/animation' namespace
|
||||
reg.On("message:send/animation", func(evt crisp.EventsReceiveAnimationMessage) {
|
||||
text := fmt.Sprintf(`(%s) *%s(%s): *[Animation](%s)`, chat_prefix, *evt.User.Nickname, *evt.User.UserID, evt.Content.URL)
|
||||
text := fmt.Sprintf(`%s *%s: *[Animation](%s)`, chat_prefix, *evt.User.Nickname, evt.Content.URL)
|
||||
sendMsgToAdmins(text, *evt.WebsiteID, *evt.SessionID)
|
||||
})
|
||||
},
|
||||
|
1
test.html
Normal file
1
test.html
Normal file
@ -0,0 +1 @@
|
||||
<script type="text/javascript">window.$crisp=[];window.CRISP_WEBSITE_ID="8635a202-94bb-49cc-a983-d69a45ca4be1";(function(){d=document;s=d.createElement("script");s.src="https://client.crisp.chat/l.js";s.async=1;d.getElementsByTagName("head")[0].appendChild(s);})();</script>
|
@ -18,10 +18,6 @@ func GetConfig() *viper.Viper {
|
||||
c.SetDefault("debug", true)
|
||||
c.SetDefault("admins", []interface{}{})
|
||||
|
||||
c.SetDefault("redis.host", "localhost:6379")
|
||||
c.SetDefault("redis.db", 0)
|
||||
c.SetDefault("redis.password", "")
|
||||
|
||||
c.SetDefault("crisp.identifier", "")
|
||||
c.SetDefault("crisp.key", "")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user