Example #1
0
// Message handler.
func (p *YouTubeJoinPlugin) Message(bot *bruxism.Bot, service bruxism.Service, message bruxism.Message) {
	if (service.IsBotOwner(message) || service.IsChannelOwner(message)) && bruxism.MatchesCommand(service, "leave", message) {
		video, ok := p.youtube.VideoIDForChatID(message.Channel())
		if ok {
			channel, ok := p.youtube.ChannelIDForVideoID(video)
			if ok {
				p.Unmonitor(channel)
			}
		}
	}
}