fixed module path; added translate endpoint to chat API

This commit is contained in:
2022-02-12 01:18:29 +01:00
parent 440aa41396
commit f2a859d084
56 changed files with 256 additions and 184 deletions

View File

@@ -2,17 +2,17 @@ package utils
import (
"context"
"csgowtfd/ent"
"csgowtfd/ent/match"
"csgowtfd/ent/matchplayer"
"csgowtfd/ent/player"
"csgowtfd/ent/roundstats"
"csgowtfd/ent/spray"
"csgowtfd/ent/weapon"
"encoding/json"
"entgo.io/ent/dialect/sql"
"errors"
"fmt"
"git.harting.dev/csgowtf/csgowtfd/ent"
"git.harting.dev/csgowtf/csgowtfd/ent/match"
"git.harting.dev/csgowtf/csgowtfd/ent/matchplayer"
"git.harting.dev/csgowtf/csgowtfd/ent/player"
"git.harting.dev/csgowtf/csgowtfd/ent/roundstats"
"git.harting.dev/csgowtf/csgowtfd/ent/spray"
"git.harting.dev/csgowtf/csgowtfd/ent/weapon"
"github.com/an0nfunc/go-steamapi"
log "github.com/sirupsen/logrus"
"go.uber.org/ratelimit"
@@ -69,6 +69,10 @@ type Conf struct {
Write int
Idle int
}
DeepL struct {
BaseURL string `yaml:"base_url"`
APIKey string `yaml:"api_key"`
} `yaml:"deepl"`
}
}
@@ -87,6 +91,13 @@ type ShareCodeResponse struct {
} `json:"result"`
}
type DeepLResponse struct {
Translations []struct {
DetectedSourceLanguage string `json:"detected_source_language"`
Text string `json:"text"`
} `json:"translations"`
}
type MatchStats struct {
Win int `json:"win,omitempty"`
Tie int `json:"tie,omitempty"`
@@ -161,10 +172,13 @@ type MateResponse struct {
}
type ChatResponse struct {
Player *PlayerResponse `json:"player,omitempty"`
Message string `json:"message"`
AllChat bool `json:"all_chat"`
Tick int `json:"tick"`
Player *PlayerResponse `json:"player,omitempty"`
Message string `json:"message"`
AllChat bool `json:"all_chat"`
Tick int `json:"tick"`
Translated bool `json:"translated,omitempty"`
TranslatedFrom string `json:"translated_from,omitempty"`
TranslatedTo string `json:"translated_to,omitempty"`
}
type WeaponDmg struct {