Skip to content

Commit

Permalink
build: serverless.yml dynamo settings add ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
noobj committed Sep 27, 2022
1 parent 245bc1e commit ff5b740
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/swimming/notify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ func Handler(ctx context.Context, request events.APIGatewayProxyRequest) (events
env := config.GetInstance()
botId := env.SwimNotifyBotId
channelId := env.SwimNotifyChannelId
message, messageExist := request.QueryStringParameters["message"]

content := url.QueryEscape("[溫腥提醒]各位奴才們,明天又到了一週最開心的週二看妹日囉😍,請別忘了 攜帶泳具👙,喵~")

if messageExist {
content = url.QueryEscape(message)
}
requestURL := fmt.Sprintf("https://api.telegram.org/bot%s/sendMessage?chat_id=%s&text=%s", botId, channelId, content)

res, err := http.Get(requestURL)
Expand Down
3 changes: 3 additions & 0 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ resources:
KeySchema:
- AttributeName: UserId
KeyType: HASH
TimeToLiveSpecification:
AttributeName: ttl
Enabled: true
TableName:
Fn::Join:
- "-"
Expand Down

0 comments on commit ff5b740

Please sign in to comment.