1
0
mirror of https://github.com/ManyakRus/telegram_loki.git synced 2024-12-04 21:05:12 +02:00

сделал telegram_bot

This commit is contained in:
Nikitin Aleksandr 2024-11-14 13:37:42 +03:00
parent eba341ec0b
commit e722ffb5a5
7 changed files with 21 additions and 13 deletions

1
.gitignore vendored
View File

@ -19,3 +19,4 @@
/bin/settings/services_add.txt
/telegram_users_rapira.json
/bin/telegram_users_rapira.json
/bin/sql_test/

View File

@ -1 +1 @@
2024-11-14 07:09:44.548
2024-11-14 10:37:34.148

View File

@ -1 +1 @@
00176
00179

View File

@ -2,6 +2,7 @@ package main
import (
"github.com/ManyakRus/starter/config_main"
"github.com/ManyakRus/starter/micro"
"github.com/ManyakRus/starter/postgres_pgx"
"github.com/ManyakRus/starter/stopapp"
"github.com/ManyakRus/starter/telegram_bot"
@ -10,6 +11,7 @@ import (
"github.com/ManyakRus/telegram_loki/internal/load_json"
"github.com/ManyakRus/telegram_loki/internal/logic"
"github.com/ManyakRus/telegram_loki/internal/telegram"
"github.com/ManyakRus/telegram_loki/pkg/version"
)
func main() {
@ -17,6 +19,8 @@ func main() {
}
func StartApp() {
micro.Show_Version(version.Version)
config_main.LoadENV_or_SettingsTXT()
config.FillSettings()
load_json.LoadJSON_All()

View File

@ -39,7 +39,7 @@ func LoadJSON_All() {
FileName = dir + config.Settings.SQL_FILES_FOLDER + micro.SeparatorFile() + "scripts.txt"
err = LoadJSON_SQL(FileName)
if err != nil {
log.Panic("LoadJSON_Services() error: ", err)
//log.Panic("LoadJSON_Services() error: ", err)
}
//scripts_add.txt, дополнительный файл, необязательный
@ -96,7 +96,7 @@ func LoadJSON_SQL(FileName string) error {
//чтение файла
bytes, err := os.ReadFile(FileName)
if err != nil {
log.Error("ReadFile() error: ", err)
log.Warn("ReadFile() error: ", err)
return err
}

View File

@ -97,9 +97,13 @@ func RunSQL() (string, error) {
if err != nil {
DeveloperName, _ = types.MapSQLDeveloper[FilenameShort]
DeveloperNameTrim := FindDeveloperName_if_err(FilenameShort, err)
err = fmt.Errorf("%w\n%s", err, DeveloperNameTrim)
log.Warn(err)
return DeveloperName, err
err2 := fmt.Errorf("%w\n%s", err, DeveloperNameTrim)
log.Warn(err2)
//запомним ошибку
MapLastErrors[FilenameShort] = err.Error()
return DeveloperName, err2
}
}
@ -109,6 +113,10 @@ func RunSQL() (string, error) {
// FindDeveloperName_if_err - возвращает имя разработчика, если ошибка другая
func FindDeveloperName_if_err(FilenemeShort string, err error) string {
//
if err == nil {
return ""
}
//DeveloperName := ""
DeveloperName, ok := types.MapSQLDeveloper[FilenemeShort]
if ok {
@ -152,11 +160,6 @@ func RunSQL1(Filename string) error {
//запомним последнюю ошибку
FilenameShort := path.Base(Filename)
TextError := ""
if err != nil {
TextError = err.Error()
}
MapLastErrors[FilenameShort] = TextError
//нет строк - это хорошо
if err == pgx.ErrNoRows {

View File

@ -1 +1 @@
9cfbb6a 2024-11-13 18:03:11 +0300
eba341e 2024-11-14 10:24:51 +0300