jammerware / margiebot

MargieBot is a .NET library designed to make building bots for Slack fast, easy, and fun.
MIT License
122 stars 42 forks source link

Fixed being invited to new channels, and allowed null responses #5

Closed AndrewArace closed 8 years ago

AndrewArace commented 8 years ago

Fixed issue where when the bot was invited into a new chathub, that hub was not registered correctly with the ConnectedHubs list.

Added escape condition on the Say() method to correctly handle a null message, giving Responders the ability to "return null" when they didn't really have anything to say.

jammerware commented 8 years ago

Nice work. Thanks for your help.

AndrewArace commented 8 years ago

You're welcome :-) lots more if you're interested - working on a responder that plays Pokémon battles using the pokeapi right now.

On Tue, Oct 27, 2015, 7:34 PM Jammerware notifications@github.com wrote:

Nice work. Thanks for your help.

— Reply to this email directly or view it on GitHub https://github.com/jammerware/margiebot/pull/5#issuecomment-151675230.

StivOstenberg commented 8 years ago

Trying to figure out a way to have the MargieBot respond to a user in DM instead of on the channel the user commented on. This worked: public BotMessage GetResponse(ResponseContext context) { BotMessage toreturn = new BotMessage(); string whoasksid = context.Message.User.ID; string alias = context.UserNameCache[whoasksid]; toreturn.Text = alias + ", EC2 Scanning activated!"; if(context.Message.Text.ToLower().EndsWith("private")) { toreturn.ChatHub = context.Message.ChatHub; toreturn.ChatHub.Type = SlackChatHubType.DM; toreturn.ChatHub.ID = whoasksid; toreturn.ChatHub.Name = "@" + whoasksid;
} return toreturn;

    }