From 4f5ebd161ed62f9aaae759d4afebc9ea661c9369 Mon Sep 17 00:00:00 2001 From: Leonardo Araujo Date: Sat, 19 Oct 2024 20:26:59 -0300 Subject: [PATCH] project refactor --- {src => cmd}/main.go | 4 +++- src/config.json => config.json | 0 {src => pkg}/config.go | 0 {src => pkg}/get_rate.go | 0 {src => pkg}/load_env.go | 0 {src => pkg}/message.go | 0 {src => pkg}/post.go | 4 ++-- {src => pkg}/profile.go | 0 {src => pkg}/relay.go | 2 +- 9 files changed, 6 insertions(+), 4 deletions(-) rename {src => cmd}/main.go (60%) rename src/config.json => config.json (100%) rename {src => pkg}/config.go (100%) rename {src => pkg}/get_rate.go (100%) rename {src => pkg}/load_env.go (100%) rename {src => pkg}/message.go (100%) rename {src => pkg}/post.go (97%) rename {src => pkg}/profile.go (100%) rename {src => pkg}/relay.go (86%) diff --git a/src/main.go b/cmd/main.go similarity index 60% rename from src/main.go rename to cmd/main.go index 3673f3f..79bcc44 100644 --- a/src/main.go +++ b/cmd/main.go @@ -3,12 +3,14 @@ package main import ( "log" "time" + + nostrbot "github.com/araujo88/bitcoin-price-bot-nostr/pkg" ) func main() { for { - err := doPost() + err := nostrbot.DoPost() if err != nil { log.Fatal(err) diff --git a/src/config.json b/config.json similarity index 100% rename from src/config.json rename to config.json diff --git a/src/config.go b/pkg/config.go similarity index 100% rename from src/config.go rename to pkg/config.go diff --git a/src/get_rate.go b/pkg/get_rate.go similarity index 100% rename from src/get_rate.go rename to pkg/get_rate.go diff --git a/src/load_env.go b/pkg/load_env.go similarity index 100% rename from src/load_env.go rename to pkg/load_env.go diff --git a/src/message.go b/pkg/message.go similarity index 100% rename from src/message.go rename to pkg/message.go diff --git a/src/post.go b/pkg/post.go similarity index 97% rename from src/post.go rename to pkg/post.go index bcd7579..35bcb65 100644 --- a/src/post.go +++ b/pkg/post.go @@ -1,4 +1,4 @@ -package main +package nostrbot import ( "context" @@ -12,7 +12,7 @@ import ( "github.com/nbd-wtf/go-nostr/nip19" ) -func doPost() error { +func DoPost() error { profile := "" cfg, err := loadConfig(profile) diff --git a/src/profile.go b/pkg/profile.go similarity index 100% rename from src/profile.go rename to pkg/profile.go diff --git a/src/relay.go b/pkg/relay.go similarity index 86% rename from src/relay.go rename to pkg/relay.go index 8978799..ae00685 100644 --- a/src/relay.go +++ b/pkg/relay.go @@ -1,4 +1,4 @@ -package main +package nostrbot type Relay struct { Read bool `json:"read"`