diff options
Diffstat (limited to 'telegram/utils.go')
-rw-r--r-- | telegram/utils.go | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/telegram/utils.go b/telegram/utils.go index cd83874..ca1884c 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -339,19 +339,13 @@ func (c *Client) formatFilePath(basedir string, id string, ext string) string { return fmt.Sprintf("%s/%x%s", basedir, sha256.Sum256([]byte(id)), ext) } -func (c *Client) formatRestrict(ban bool, hours int64) client.ChatMemberStatus { +func (c *Client) formatBantime(hours int64) int32 { var until int32 - if hours != 0 { + if hours > 0 { until = int32(time.Now().Unix() + hours*3600) } - if ban { - return &client.ChatMemberStatusBanned{ - BannedUntilDate: until, - } - } else { - return &client.ChatMemberStatusLeft{} - } + return until } func (c *Client) messageToText(message *client.Message) string { |