Pins to supergroups, managed by admins
This commit is contained in:
@@ -4,21 +4,19 @@
|
||||
package welcomer
|
||||
|
||||
import (
|
||||
// stdlib
|
||||
"strconv"
|
||||
// 3rd party
|
||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func (w *Welcomer) alertUserWithoutProfile(update tgbotapi.Update) string {
|
||||
func (w *Welcomer) alertUserWithoutProfile(update *tgbotapi.Update, newUser *tgbotapi.User) string {
|
||||
alertGroupID, _ := strconv.ParseInt(c.Cfg.Notifications.GroupID, 10, 64)
|
||||
chat, ok := c.Getters.GetOrCreateChat(&update)
|
||||
chat, ok := c.Getters.GetOrCreateChat(update)
|
||||
if !ok {
|
||||
return "fail"
|
||||
}
|
||||
|
||||
message := "*Новый вход пользователя без профиля в чат с ботом!*\n"
|
||||
message += "В чат _" + chat.Name + "_ вошёл некто @" + update.Message.NewChatMember.UserName
|
||||
message += "В чат _" + chat.Name + "_ вошёл некто @" + newUser.UserName
|
||||
message += ". Он получил уведомление о том, что ему нужно создать профиль в боте."
|
||||
|
||||
msg := tgbotapi.NewMessage(alertGroupID, message)
|
||||
@@ -29,15 +27,15 @@ func (w *Welcomer) alertUserWithoutProfile(update tgbotapi.Update) string {
|
||||
return "ok"
|
||||
}
|
||||
|
||||
func (w *Welcomer) alertSpyUser(update tgbotapi.Update) string {
|
||||
func (w *Welcomer) alertSpyUser(update *tgbotapi.Update, newUser *tgbotapi.User) string {
|
||||
alertGroupID, _ := strconv.ParseInt(c.Cfg.Notifications.GroupID, 10, 64)
|
||||
chat, ok := c.Getters.GetOrCreateChat(&update)
|
||||
chat, ok := c.Getters.GetOrCreateChat(update)
|
||||
if !ok {
|
||||
return "fail"
|
||||
}
|
||||
|
||||
message := "*Шпион в деле!*\n"
|
||||
message += "В чат _" + chat.Name + "_ вошёл некто @" + update.Message.NewChatMember.UserName
|
||||
message += "В чат _" + chat.Name + "_ вошёл некто @" + newUser.UserName
|
||||
message += ". У него профиль другой лиги. Ждём обновлений."
|
||||
|
||||
msg := tgbotapi.NewMessage(alertGroupID, message)
|
||||
|
||||
Reference in New Issue
Block a user