Compare commits

...

6 Commits

Author SHA1 Message Date
4456ca69a2 test
All checks were successful
continuous-integration/drone/pr Build is passing
2021-06-25 18:32:36 +03:00
8a3614419a CI
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-25 18:29:11 +03:00
4c88f0268d CI fix
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-25 17:51:39 +03:00
4bf5914d89 small fix
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-24 22:13:14 +03:00
d2cf73b61d Merge branch 'hotfix' into master
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2021-06-24 21:29:58 +03:00
3d010de8e0 fix fragCount
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-24 21:28:55 +03:00
4 changed files with 23 additions and 13 deletions

View File

@ -7,6 +7,14 @@ platform:
os: linux
arch: amd64
trigger:
branch:
- master
event:
include:
- push
- pull_request
steps:
- name: build
commands:
@ -16,12 +24,12 @@ steps:
commands:
- make install
when:
branch:
- master
event:
- push
- name: restart
commands:
- systemctl restart craft-bot
when:
branch:
- master
event:
- push

View File

@ -53,10 +53,16 @@ func (fms *fragMessages) addFrag(ctx context.Context, playerName string, entityN
fmt.Sprintf("%s убил %s ✗ *%d*", fm.playerName, fm.entityName, fm.fragCount),
)
mess.ParseMode = tgbotapi.ModeMarkdown
_, err := botApi.Send(mess)
m, err := botApi.Send(mess)
if err != nil {
return err
}
if m.MessageID != fm.messageID {
m.MessageID = fm.messageID
getLogger(ctx).Info("message id was changed")
}
return nil
}
}
@ -74,7 +80,7 @@ func (fms *fragMessages) addFrag(ctx context.Context, playerName string, entityN
entityName: entityName,
chatID: cfg.ChatID,
messageID: m.MessageID,
fragCount: 0,
fragCount: 1,
latestFragTime: time.Now(),
}

View File

@ -114,13 +114,11 @@ func (c *quitCommand) run(ctx context.Context) {
err = db.updatePlayerLastLogout(ctx, p.id, time.Now())
if err != nil {
log.Error(err)
return
}
err = db.increasePlayerOnlineDuration(ctx, p.id, time.Now().Sub(p.lastLogin))
err = db.increasePlayerOnlineDuration(ctx, p.id, time.Since(p.lastLogin))
if err != nil {
log.Error(err)
return
}
pb.getPlayerBoard(p.id).setOnline(false)
@ -150,7 +148,6 @@ func (c *deathCommand) run(ctx context.Context) {
err = db.increasePlayerDeath(ctx, p.id, 1)
if err != nil {
log.Error(err)
return
}
err = pb.update(ctx, achievementDeathless, achievementBestFeeder)
@ -173,7 +170,6 @@ func (c *killCommand) run(ctx context.Context) {
err := fms.addFrag(ctx, c.name, c.entity)
if err != nil {
log.Error(err)
return
}
p, err := db.getPlayerByName(ctx, c.name)
@ -185,7 +181,6 @@ func (c *killCommand) run(ctx context.Context) {
err = db.increasePlayerEntryKills(ctx, p.id, c.entity, 1)
if err != nil {
log.Error(err)
return
}
err = pb.update(ctx, achievementMaxFrags, achievementPeaceable)
@ -213,7 +208,6 @@ func (c *changeLevelCommand) run(ctx context.Context) {
err = db.updatePlayerLevel(ctx, p.id, c.newLevel)
if err != nil {
log.Error(err)
return
}
err = pb.update(ctx, achievementMaxLevel)

View File

@ -78,6 +78,8 @@ func main() {
runHttpServer(ctx, cfg.Http, &wg)
runSignalHandler(ctx, cancelFunc)
getLogger(ctx).Infof("Running")
wg.Wait()
}