diff --git a/telegram/utils.go b/telegram/utils.go index 910bfd6..dbb65d7 100644 --- a/telegram/utils.go +++ b/telegram/utils.go @@ -489,6 +489,28 @@ func (c *Client) messageToText(message *client.Message) string { case client.TypeMessageDice: dice, _ := message.Content.(*client.MessageDice) return fmt.Sprintf("%s 1d6: [%v]", dice.Emoji, dice.Value) + case client.TypeMessagePoll: + poll, _ := message.Content.(*client.MessagePoll) + + rows := []string{} + rows = append(rows, fmt.Sprintf("*%s*", poll.Poll.Question)) + for _, option := range poll.Poll.Options { + var tick string + if option.IsChosen { + tick = "x" + } else { + tick = " " + } + rows = append(rows, fmt.Sprintf( + "[%s] %s | %v%% | %v vote", + tick, + option.Text, + option.VotePercentage, + option.VoterCount, + )) + } + + return strings.Join(rows, "\n") } return fmt.Sprintf("unknown message (%s)", message.Content.MessageContentType())