Archived
1

Pins to supergroups, managed by admins

This commit is contained in:
2017-11-14 03:44:21 +04:00
parent 5c08899d25
commit 95a9a2146a
84 changed files with 786 additions and 622 deletions

View File

@@ -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)