Фраги приходят в одно сообщение и добавляют цифру, если это тот же тип фрага. Сообщения не удаляются дольше, если недавно был сделан такой же фраг
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
smsteel
2021-06-24 17:56:49 +03:00
parent 70594a62d2
commit 90a86fc18b
5 changed files with 156 additions and 15 deletions

View File

@ -165,19 +165,15 @@ type killCommand struct {
}
func (c *killCommand) run(ctx context.Context) {
botApi := getBotApi(ctx)
cfg := getConfig(ctx)
mc := getMessageCleaner(ctx)
db := getDB(ctx)
log := getLogger(ctx)
pb := getDPlayersBoard(ctx)
fms := getFragMessages(ctx)
mess := tgbotapi.NewMessage(cfg.ChatID, fmt.Sprintf("%s убил %s", c.name, c.entity))
m, err := botApi.Send(mess)
err := fms.addFrag(ctx, c.name, c.entity)
if err != nil {
log.Error(err)
} else {
mc.add(ctx, m.MessageID, cfg.ChatID, time.Second*30)
return
}
p, err := db.getPlayerByName(ctx, c.name)