Compare commits

..

13 Commits

Author SHA1 Message Date
Владимир Фёдоров e1873bddf3 Merge remote-tracking branch 'origin/master'
continuous-integration/drone/push Build is passing Details
2023-03-11 12:32:53 +07:00
Владимир Фёдоров 80f814a105 update README.md 2023-03-11 12:32:38 +07:00
user-penguin 9aae4d2f23 ver. up
continuous-integration/drone/push Build is passing Details
2023-03-08 15:55:54 +07:00
user-penguin 3e61a8a3c2 ver. up
continuous-integration/drone/push Build is passing Details
2023-03-08 15:54:55 +07:00
user-penguin 60fbf7c214 ver. up
continuous-integration/drone/push Build is passing Details
2023-03-08 15:46:47 +07:00
user-penguin c0dae8b8a3 ver. up
continuous-integration/drone/push Build is passing Details
2023-03-08 15:43:57 +07:00
user-penguin dc2c3bfee4 fix
continuous-integration/drone/push Build is passing Details
2023-03-08 15:42:22 +07:00
user-penguin 4e2db0fafb edit bot deploy path
continuous-integration/drone/push Build is failing Details
2023-03-08 15:40:53 +07:00
user-penguin c11d7f1924 edit drone.yml
continuous-integration/drone/push Build is failing Details
2023-03-08 15:35:35 +07:00
Владимир Фёдоров 2cc6341623 add cron.txt
continuous-integration/drone/push Build is failing Details
2023-03-08 00:40:16 +07:00
Владимир Фёдоров fded974d4f add verochka.service file 2023-03-08 00:20:44 +07:00
Владимир Фёдоров 9a1a99985c fix 2023-02-10 15:51:04 +07:00
old-flex 9415ce4c37 Merge pull request 'kostyan/trash' (#1) from kostyan/trash into master
Reviewed-on: https://git.user-penguin.space/vladimir/verochka/pulls/1
2023-02-10 15:46:52 +07:00
11 changed files with 26 additions and 46 deletions

View File

@ -12,15 +12,15 @@ steps:
image: appleboy/drone-scp image: appleboy/drone-scp
settings: settings:
host: host:
from_secret: ssh_ip from_secret: server_ip
username: username:
from_secret: ssh_login from_secret: ssh_user
password: key:
from_secret: ssh_pass from_secret: ssh_key
port: port:
from_secret: ssh_port from_secret: ssh_port
target: target:
- bots/verochka_tg_bot - deploys/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: ssh_ip from_secret: server_ip
username: username:
from_secret: ssh_login from_secret: ssh_user
password: key:
from_secret: ssh_pass from_secret: ssh_key
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 bots/verochka_tg_bot - cd deploys/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_tg_bot - echo $${PASSWORD} | sudo -S systemctl restart verochka
trigger: trigger:
event: event:

View File

@ -3,13 +3,6 @@
## develop ## develop
git clone https://github.com/3crabs/student-verochka-bot student_bot git clone https://git.3crabs.ru/VLADIMIR/verochka verochka
cd student_bot cd verochka
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> &

3
cron.txt Normal file
View File

@ -0,0 +1,3 @@
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,14 +4,9 @@ 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 ( require github.com/technoweenie/multipartstreamer v1.0.1 // indirect
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,10 +1,5 @@
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=
@ -13,13 +8,3 @@ 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.3), отправь:\n\n" + return "Вот чем я могу вам помочь (v1.4.6), отправь:\n\n" +
"- /ping отобью pong\n" + "- /ping отобью pong\n" +
"- /today_lessons покажу расписание на сегодня\n" + "- /today_lessons покажу расписание на сегодня\n" +
"- /tomorrow_lessons покажу расписание на завтра\n" + "- /tomorrow_lessons покажу расписание на завтра\n" +

4
verochka.service Normal file
View File

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