aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2022-02-01 07:57:17 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2022-02-01 07:57:17 +0300
commit9a49d662798be02e39b3bd88f64b4a8d40497ad2 (patch)
tree7786a0807dde54225c127ce5f32a2a3a411ca49d /telegram/utils.go
parentde31fa0ad210bef630aafda68a65a482044fc88b (diff)
Add /mute / /unmute commands
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go12
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 {