This commit is contained in:
19
handlers.go
19
handlers.go
@ -49,7 +49,7 @@ func (c *joinCommand) run(ctx context.Context) {
|
||||
log := getLogger(ctx)
|
||||
pb := getDPlayersBoard(ctx)
|
||||
|
||||
mess := tgbotapi.NewMessage(cfg.ChatID, fmt.Sprintf("%s вошел в матрицу", c.name))
|
||||
mess := tgbotapi.NewMessage(cfg.ChatID, fmt.Sprintf("%s подключился", c.name))
|
||||
m, err := botApi.Send(mess)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
@ -77,7 +77,9 @@ func (c *joinCommand) run(ctx context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
err = pb.getPlayerBoard(p.id).setOnline(true).updatePlayerInfo(ctx)
|
||||
pb.getPlayerBoard(p.id).setOnline(true)
|
||||
|
||||
err = pb.update(ctx, achievementVeryLongOnline)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
@ -95,7 +97,7 @@ func (c *quitCommand) run(ctx context.Context) {
|
||||
log := getLogger(ctx)
|
||||
pb := getDPlayersBoard(ctx)
|
||||
|
||||
mess := tgbotapi.NewMessage(cfg.ChatID, fmt.Sprintf("%s покинул матрицу", c.name))
|
||||
mess := tgbotapi.NewMessage(cfg.ChatID, fmt.Sprintf("%s отключился", c.name))
|
||||
m, err := botApi.Send(mess)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
@ -115,7 +117,9 @@ func (c *quitCommand) run(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = pb.getPlayerBoard(p.id).setOnline(false).updatePlayerInfo(ctx)
|
||||
pb.getPlayerBoard(p.id).setOnline(false)
|
||||
|
||||
err = pb.update(ctx, achievementVeryLongOnline)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
@ -143,7 +147,7 @@ func (c *deathCommand) run(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = pb.getPlayerBoard(p.id).updatePlayerInfo(ctx)
|
||||
err = pb.update(ctx, achievementDeathless, achievementBestFeeder)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
@ -182,7 +186,7 @@ func (c *killCommand) run(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = pb.getPlayerBoard(p.id).updatePlayerInfo(ctx)
|
||||
err = pb.update(ctx, achievementMaxFrags, achievementPeaceable)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
@ -210,9 +214,8 @@ func (c *changeLevelCommand) run(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = pb.getPlayerBoard(p.id).updatePlayerInfo(ctx)
|
||||
err = pb.update(ctx, achievementMaxLevel)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user