36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
|
package models
|
||
|
|
||
|
type Group struct {
|
||
|
ID uint `gorm:"primary_key"`
|
||
|
GroupID int64
|
||
|
Size int
|
||
|
UserJoinMessage string `gorm:"column:msg_user_join;type:text"`
|
||
|
UserVerifiedMessage string `gorm:"column:msg_user_verified;type:text"`
|
||
|
UserLeaveMessage string `gorm:"column:msg_user_leave;type:text"`
|
||
|
UserKickMessage string `gorm:"column:msg_user_kick;type:text"`
|
||
|
ForbidWriting bool `gorm:"column:forbid_writing"`
|
||
|
OnlineCheck int `gorm:"column:kick_cooldown"`
|
||
|
}
|
||
|
|
||
|
func (group *Group) FillDefaultValues() {
|
||
|
if len(group.UserKickMessage) == 0 {
|
||
|
group.UserKickMessage = "[{{user.firstname}} {{user.lastname}}](tg://user?id={{user.id}}) did not verify!\n They are going to leave us."
|
||
|
}
|
||
|
|
||
|
if len(group.UserJoinMessage) == 0 {
|
||
|
group.UserJoinMessage = "[{{user.firstname}} {{user.lastname}}](tg://user?id={{user.id}}) joined us. Hello and Welcome! Please verify that you are not a bot."
|
||
|
}
|
||
|
|
||
|
if len(group.UserLeaveMessage) == 0 {
|
||
|
group.UserLeaveMessage = "[{{user.firstname}} {{user.lastname}}](tg://user?id={{user.id}}) left us."
|
||
|
}
|
||
|
|
||
|
if len(group.UserVerifiedMessage) == 0 {
|
||
|
group.UserVerifiedMessage = "[{{user.firstname}} {{user.lastname}}](tg://user?id={{user.id}}) is now permitted to stay in the chat!"
|
||
|
}
|
||
|
|
||
|
if group.OnlineCheck == 0 {
|
||
|
group.OnlineCheck = 5
|
||
|
}
|
||
|
}
|