Compare commits
13 Commits
kostyan/tr
...
master
Author | SHA1 | Date |
---|---|---|
Владимир Фёдоров | e1873bddf3 | |
Владимир Фёдоров | 80f814a105 | |
user-penguin | 9aae4d2f23 | |
user-penguin | 3e61a8a3c2 | |
user-penguin | 60fbf7c214 | |
user-penguin | c0dae8b8a3 | |
user-penguin | dc2c3bfee4 | |
user-penguin | 4e2db0fafb | |
user-penguin | c11d7f1924 | |
Владимир Фёдоров | 2cc6341623 | |
Владимир Фёдоров | fded974d4f | |
Владимир Фёдоров | 9a1a99985c | |
old-flex | 9415ce4c37 |
22
.drone.yml
22
.drone.yml
|
@ -12,15 +12,15 @@ steps:
|
|||
image: appleboy/drone-scp
|
||||
settings:
|
||||
host:
|
||||
from_secret: ssh_ip
|
||||
from_secret: server_ip
|
||||
username:
|
||||
from_secret: ssh_login
|
||||
password:
|
||||
from_secret: ssh_pass
|
||||
from_secret: ssh_user
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
port:
|
||||
from_secret: ssh_port
|
||||
target:
|
||||
- bots/verochka_tg_bot
|
||||
- deploys/verochka_tg_bot
|
||||
source:
|
||||
- verochka_tg_bot
|
||||
- config
|
||||
|
@ -39,21 +39,21 @@ steps:
|
|||
from_secret: ssh_pass
|
||||
settings:
|
||||
host:
|
||||
from_secret: ssh_ip
|
||||
from_secret: server_ip
|
||||
username:
|
||||
from_secret: ssh_login
|
||||
password:
|
||||
from_secret: ssh_pass
|
||||
from_secret: ssh_user
|
||||
key:
|
||||
from_secret: ssh_key
|
||||
port:
|
||||
from_secret: ssh_port
|
||||
envs: [ TOKEN,TOKEN_WEATHER,CHAT_ID,PASSWORD ]
|
||||
command_timeout: 10s
|
||||
script:
|
||||
- cd bots/verochka_tg_bot
|
||||
- cd deploys/verochka_tg_bot
|
||||
- echo $${TOKEN} > token.txt
|
||||
- echo $${TOKEN_WEATHER} > token_weather.txt
|
||||
- echo $${CHAT_ID} > chat_id.txt
|
||||
- echo $${PASSWORD} | sudo -S systemctl restart verochka_tg_bot
|
||||
- echo $${PASSWORD} | sudo -S systemctl restart verochka
|
||||
|
||||
trigger:
|
||||
event:
|
||||
|
|
11
README.md
11
README.md
|
@ -3,13 +3,6 @@
|
|||
|
||||
## develop
|
||||
|
||||
git clone https://github.com/3crabs/student-verochka-bot student_bot
|
||||
cd student_bot
|
||||
git clone https://git.3crabs.ru/VLADIMIR/verochka verochka
|
||||
cd verochka
|
||||
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> &
|
||||
|
|
|
@ -15,7 +15,7 @@ const (
|
|||
Ping = Command("/ping")
|
||||
TodayLessons = Command("/today_lessons")
|
||||
TomorrowLessons = Command("/tomorrow_lessons")
|
||||
AllLessons = Command("/all_lessons")
|
||||
AllLessons = Command("/all_lessons")
|
||||
Weather = Command("/weather")
|
||||
NewYear = Command("/new_year")
|
||||
)
|
||||
|
|
|
@ -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
7
go.mod
|
@ -4,14 +4,9 @@ go 1.17
|
|||
|
||||
require (
|
||||
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/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible
|
||||
github.com/umputun/go-flags v1.5.1
|
||||
)
|
||||
|
||||
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
|
||||
)
|
||||
require github.com/technoweenie/multipartstreamer v1.0.1 // indirect
|
||||
|
|
15
go.sum
15
go.sum
|
@ -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/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/go.mod h1:VFnDugGvBJREsor/aiVcXhvAbyjatl0AKXEaGV9u63I=
|
||||
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/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=
|
||||
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=
|
||||
|
|
2
main.go
2
main.go
|
@ -190,7 +190,7 @@ func run() {
|
|||
sendTomorrowLessonsToChat(bot, chatID, "Завтра, "+update.Message.From.FirstName+", эти пары:")
|
||||
|
||||
case commands.AllLessons:
|
||||
sendAllLessonsToChat(bot, chatID, "Пока знаю про эти пары:")
|
||||
sendAllLessonsToChat(bot, chatID, "Пока знаю про эти пары:")
|
||||
|
||||
case commands.Weather:
|
||||
w, err := weather.GetWeatherWithCache(opts.Key, 53.346853, 83.777012, time.Hour)
|
||||
|
|
|
@ -30,7 +30,7 @@ func ThanksMessage() string {
|
|||
}
|
||||
|
||||
func HelpMessage(chatID int64) string {
|
||||
return "Вот чем я могу вам помочь (v1.4.3), отправь:\n\n" +
|
||||
return "Вот чем я могу вам помочь (v1.4.6), отправь:\n\n" +
|
||||
"- /ping отобью pong\n" +
|
||||
"- /today_lessons покажу расписание на сегодня\n" +
|
||||
"- /tomorrow_lessons покажу расписание на завтра\n" +
|
||||
|
|
|
@ -8,6 +8,6 @@ import (
|
|||
)
|
||||
|
||||
func main() {
|
||||
lessons := parser.ParseByDay(date.Today(-48*time.Hour))
|
||||
lessons := parser.ParseByDay(date.Today(-48 * time.Hour))
|
||||
fmt.Println(lessons)
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ func parse() []Lesson {
|
|||
l := Lesson{
|
||||
Number: "",
|
||||
TimeStart: event.Start,
|
||||
TimeMsg: event.Start.Format("15:04") + " - " + event.End.Format("15:04"),
|
||||
TimeMsg: event.Start.Format("15:04") + " - " + event.End.Format("15:04"),
|
||||
Name: event.Summary,
|
||||
User: event.Description,
|
||||
Place: event.Location,
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[Service]
|
||||
WorkingDirectory=/home/crab/deploys/verochka_tg_bot
|
||||
ExecStart=/home/crab/deploys/verochka_tg_bot/verochka_tg_bot
|
||||
Restart=always
|
Loading…
Reference in New Issue