Compare commits

..

No commits in common. "master" and "kostyan/trash" have entirely different histories.

11 changed files with 46 additions and 26 deletions

View File

@ -12,15 +12,15 @@ steps:
image: appleboy/drone-scp image: appleboy/drone-scp
settings: settings:
host: host:
from_secret: server_ip from_secret: ssh_ip
username: username:
from_secret: ssh_user from_secret: ssh_login
key: password:
from_secret: ssh_key from_secret: ssh_pass
port: port:
from_secret: ssh_port from_secret: ssh_port
target: target:
- deploys/verochka_tg_bot - bots/verochka_tg_bot
source: source:
- verochka_tg_bot - verochka_tg_bot
- config - config
@ -39,21 +39,21 @@ steps:
from_secret: ssh_pass from_secret: ssh_pass
settings: settings:
host: host:
from_secret: server_ip from_secret: ssh_ip
username: username:
from_secret: ssh_user from_secret: ssh_login
key: password:
from_secret: ssh_key from_secret: ssh_pass
port: port:
from_secret: ssh_port from_secret: ssh_port
envs: [ TOKEN,TOKEN_WEATHER,CHAT_ID,PASSWORD ] envs: [ TOKEN,TOKEN_WEATHER,CHAT_ID,PASSWORD ]
command_timeout: 10s command_timeout: 10s
script: script:
- cd deploys/verochka_tg_bot - cd bots/verochka_tg_bot
- echo $${TOKEN} > token.txt - echo $${TOKEN} > token.txt
- echo $${TOKEN_WEATHER} > token_weather.txt - echo $${TOKEN_WEATHER} > token_weather.txt
- echo $${CHAT_ID} > chat_id.txt - echo $${CHAT_ID} > chat_id.txt
- echo $${PASSWORD} | sudo -S systemctl restart verochka - echo $${PASSWORD} | sudo -S systemctl restart verochka_tg_bot
trigger: trigger:
event: event:

View File

@ -3,6 +3,13 @@
## develop ## develop
git clone https://git.3crabs.ru/VLADIMIR/verochka verochka git clone https://github.com/3crabs/student-verochka-bot student_bot
cd verochka cd student_bot
go run main.go --token=<TELEGRAM_API_TOKEN> --key=<YANDEX_WEATHER_API_KEY> go run main.go --token=<TELEGRAM_API_TOKEN> --key=<YANDEX_WEATHER_API_KEY>
## deploy
git clone https://github.com/3crabs/student-verochka-bot student_bot
cd student_bot
go build -v -o bin/bot
./bin/bot --token=<TELEGRAM_API_TOKEN> --key=<YANDEX_WEATHER_API_KEY> &

View File

@ -1,3 +0,0 @@
0 3 * * 1-5 curl http://127.0.0.1:10001/send_today_lessons_to_chat
0 15 * * 1-5 curl http://127.0.0.1:10001/send_tomorrow_lessons_to_chat
0 5 20-31 12 * curl http://127.0.0.1:10001/send_new_year_to_chat

7
go.mod
View File

@ -4,9 +4,14 @@ go 1.17
require ( require (
github.com/3crabs/go-yandex-weather-api v0.6.0 github.com/3crabs/go-yandex-weather-api v0.6.0
github.com/PuerkitoBio/goquery v1.7.1
github.com/erizocosmico/go-ics v0.0.0-20180527181030-697b9000b86f github.com/erizocosmico/go-ics v0.0.0-20180527181030-697b9000b86f
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible
github.com/umputun/go-flags v1.5.1 github.com/umputun/go-flags v1.5.1
) )
require github.com/technoweenie/multipartstreamer v1.0.1 // indirect require (
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
)

15
go.sum
View File

@ -1,5 +1,10 @@
github.com/3crabs/go-yandex-weather-api v0.6.0 h1:EpqAfaStJNVRNRyYsvUmiNFQYGrQ+eXVP2e+vMWIh08= github.com/3crabs/go-yandex-weather-api v0.6.0 h1:EpqAfaStJNVRNRyYsvUmiNFQYGrQ+eXVP2e+vMWIh08=
github.com/3crabs/go-yandex-weather-api v0.6.0/go.mod h1:MZLPelQjylEK4nPL9g2cpnAPtqzOpF/SrtRGWXK7QHs= github.com/3crabs/go-yandex-weather-api v0.6.0/go.mod h1:MZLPelQjylEK4nPL9g2cpnAPtqzOpF/SrtRGWXK7QHs=
github.com/PuerkitoBio/goquery v1.7.1 h1:oE+T06D+1T7LNrn91B4aERsRIeCLJ/oPSa6xB9FPnz4=
github.com/PuerkitoBio/goquery v1.7.1/go.mod h1:XY0pP4kfraEmmV1O7Uf6XyjoslwsneBbgeDjLYuN8xY=
github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/erizocosmico/go-ics v0.0.0-20180527181030-697b9000b86f h1:IUdUh6y8VDhn5iO/ggBCVb9H0vOI3MDlhDSDCrrSC8Q= github.com/erizocosmico/go-ics v0.0.0-20180527181030-697b9000b86f h1:IUdUh6y8VDhn5iO/ggBCVb9H0vOI3MDlhDSDCrrSC8Q=
github.com/erizocosmico/go-ics v0.0.0-20180527181030-697b9000b86f/go.mod h1:VFnDugGvBJREsor/aiVcXhvAbyjatl0AKXEaGV9u63I= github.com/erizocosmico/go-ics v0.0.0-20180527181030-697b9000b86f/go.mod h1:VFnDugGvBJREsor/aiVcXhvAbyjatl0AKXEaGV9u63I=
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU= github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible h1:2cauKuaELYAEARXRkq2LrJ0yDDv1rW7+wrTEdVL3uaU=
@ -8,3 +13,13 @@ github.com/technoweenie/multipartstreamer v1.0.1 h1:XRztA5MXiR1TIRHxH2uNxXxaIkKQ
github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog= github.com/technoweenie/multipartstreamer v1.0.1/go.mod h1:jNVxdtShOxzAsukZwTSw6MDx5eUJoiEBsSvzDU9uzog=
github.com/umputun/go-flags v1.5.1 h1:vRauoXV3Ultt1HrxivSxowbintgZLJE+EcBy5ta3/mY= github.com/umputun/go-flags v1.5.1 h1:vRauoXV3Ultt1HrxivSxowbintgZLJE+EcBy5ta3/mY=
github.com/umputun/go-flags v1.5.1/go.mod h1:nTbvsO/hKqe7Utri/NoyN18GR3+EWf+9RrmsdwdhrEc= github.com/umputun/go-flags v1.5.1/go.mod h1:nTbvsO/hKqe7Utri/NoyN18GR3+EWf+9RrmsdwdhrEc=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

View File

@ -30,7 +30,7 @@ func ThanksMessage() string {
} }
func HelpMessage(chatID int64) string { func HelpMessage(chatID int64) string {
return "Вот чем я могу вам помочь (v1.4.6), отправь:\n\n" + return "Вот чем я могу вам помочь (v1.4.3), отправь:\n\n" +
"- /ping отобью pong\n" + "- /ping отобью pong\n" +
"- /today_lessons покажу расписание на сегодня\n" + "- /today_lessons покажу расписание на сегодня\n" +
"- /tomorrow_lessons покажу расписание на завтра\n" + "- /tomorrow_lessons покажу расписание на завтра\n" +

View File

@ -8,6 +8,6 @@ import (
) )
func main() { func main() {
lessons := parser.ParseByDay(date.Today(-48 * time.Hour)) lessons := parser.ParseByDay(date.Today(-48*time.Hour))
fmt.Println(lessons) fmt.Println(lessons)
} }

View File

@ -1,4 +0,0 @@
[Service]
WorkingDirectory=/home/crab/deploys/verochka_tg_bot
ExecStart=/home/crab/deploys/verochka_tg_bot/verochka_tg_bot
Restart=always