Esempio n. 1
0
func (c *Core) handleChannels(b core.Bot, m *slack.Message) error {
	if len(b.ActiveChannels()) == 0 {
		return b.Say(m.Channel, "currently listening to *no* channels.")
	}
	activeChannelsText := "currently listening to the following channels:\n"
	for _, channelID := range b.ActiveChannels() {
		if channel := b.FindChannel(channelID); channel != nil {
			activeChannelsText = activeChannelsText + fmt.Sprintf(">#%s (id:%s)\n", channel.Name, channel.ID)
		}
	}
	return b.Say(m.Channel, activeChannelsText)
}