The easy to use and full featured Irc Bot everyone is talking about!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Invite.cs 1.5KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Combot.IRCServices.Messaging;
  2. namespace Combot.Modules.Plugins
  3. {
  4. public class Invite : Module
  5. {
  6. public override void Initialize()
  7. {
  8. Bot.IRC.Message.InviteChannelEvent += HandleInvite;
  9. }
  10. private void HandleInvite(object sender, InviteChannelInfo inviteInfo)
  11. {
  12. if (Enabled
  13. && !Bot.ServerConfig.NickBlacklist.Contains(inviteInfo.Requester.Nickname)
  14. && !NickBlacklist.Contains(inviteInfo.Requester.Nickname))
  15. {
  16. if (!Bot.ServerConfig.ChannelBlacklist.Contains(inviteInfo.Channel) && !ChannelBlacklist.Contains(inviteInfo.Channel))
  17. {
  18. Bot.IRC.Command.SendJoin(inviteInfo.Channel);
  19. string helpMessage = string.Empty;
  20. if (Bot.Modules.Exists(module => module.Commands.Exists(cmd => cmd.Triggers.Contains("help") && cmd.Enabled)))
  21. {
  22. helpMessage = string.Format(" For more information on what I can do, just type: {0}help", Bot.ServerConfig.CommandPrefix);
  23. }
  24. Bot.IRC.Command.SendPrivateMessage(inviteInfo.Channel, string.Format("{0} has invited me to this channel. If you would like me to leave, just kick me.{1}", inviteInfo.Requester.Nickname, helpMessage));
  25. }
  26. else
  27. {
  28. Bot.IRC.Command.SendNotice(inviteInfo.Requester.Nickname, "I am unable to join that channel.");
  29. }
  30. }
  31. }
  32. }
  33. }