aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 0a70af8..556b1a7 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -312,6 +312,21 @@ func (c *Client) formatContent(file *client.File, filename string) string {
)
}
+func (c *Client) formatRestrict(ban bool, hours int64) client.ChatMemberStatus {
+ var until int32
+ if hours != 0 {
+ until = int32(time.Now().Unix() + hours*3600)
+ }
+
+ if ban {
+ return &client.ChatMemberStatusBanned{
+ BannedUntilDate: until,
+ }
+ } else {
+ return &client.ChatMemberStatusLeft{}
+ }
+}
+
func (c *Client) messageToText(message *client.Message) string {
if message.Content == nil {
log.Warnf("Unknown message (big emoji?): %#v", message)