mirror of
https://github.com/ManyakRus/telegram_loki.git
synced 2024-12-03 08:55:23 +02:00
сделал telegram_bot
This commit is contained in:
parent
eba341ec0b
commit
e722ffb5a5
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,3 +19,4 @@
|
||||
/bin/settings/services_add.txt
|
||||
/telegram_users_rapira.json
|
||||
/bin/telegram_users_rapira.json
|
||||
/bin/sql_test/
|
||||
|
@ -1 +1 @@
|
||||
2024-11-14 07:09:44.548
|
||||
2024-11-14 10:37:34.148
|
@ -1 +1 @@
|
||||
00176
|
||||
00179
|
@ -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()
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -1 +1 @@
|
||||
9cfbb6a 2024-11-13 18:03:11 +0300
|
||||
eba341e 2024-11-14 10:24:51 +0300
|
||||
|
Loading…
Reference in New Issue
Block a user