-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathstart.go
35 lines (31 loc) · 1.2 KB
/
start.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package commands
import (
"EverythingSuckz/fsb/config"
"EverythingSuckz/fsb/internal/utils"
"github.com/celestix/gotgproto/dispatcher"
"github.com/celestix/gotgproto/dispatcher/handlers"
"github.com/celestix/gotgproto/ext"
"github.com/celestix/gotgproto/storage"
)
func (m *command) LoadStart(dispatcher dispatcher.Dispatcher) {
log := m.log.Named("start")
defer log.Sugar().Info("Loaded")
dispatcher.AddHandler(handlers.NewCommand("start", start))
}
func start(ctx *ext.Context, u *ext.Update) error {
chatId := u.EffectiveChat().GetID()
peerChatId := ctx.PeerStorage.GetPeerById(chatId)
if peerChatId.Type != int(storage.TypeUser) {
return dispatcher.EndGroups
}
if !config.ValueOf.BlockFlag && len(config.ValueOf.UsersID) != 0 && !utils.Contains(config.ValueOf.UsersID, chatId) {
ctx.Reply(u, "You are not allowed to use this bot.", nil)
return dispatcher.EndGroups
}
if config.ValueOf.BlockFlag && len(config.ValueOf.UsersID) != 0 && utils.Contains(config.ValueOf.UsersID, chatId) {
ctx.Reply(u, "You are blocked from using this bot.", nil)
return dispatcher.EndGroups
}
ctx.Reply(u, "Hi, send me any file to get a direct streamble link to that file.", nil)
return dispatcher.EndGroups
}