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.9KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. // Check to see if it's being spammed
  19. if (Bot.SpamCheck(Bot.IRC.Channels.Find(chan => chan.Name == inviteInfo.Channel), inviteInfo.Requester, this, new Command() { Name = string.Format("{0} Commands", Name) }))
  20. {
  21. Bot.IRC.Command.SendJoin(inviteInfo.Channel);
  22. string helpMessage = string.Empty;
  23. if (Bot.Modules.Exists(module => module.Commands.Exists(cmd => cmd.Triggers.Contains("help") && cmd.Enabled)))
  24. {
  25. helpMessage = string.Format(" For more information on what I can do, just type: {0}help", Bot.ServerConfig.CommandPrefix);
  26. }
  27. 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));
  28. }
  29. }
  30. else
  31. {
  32. Bot.IRC.Command.SendNotice(inviteInfo.Requester.Nickname, "I am unable to join that channel.");
  33. }
  34. }
  35. }
  36. }
  37. }