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.

Command.cs 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System.Collections.Generic;
  2. namespace Combot.Modules
  3. {
  4. public class Command
  5. {
  6. public string Name { get; set; }
  7. public string Description { get; set; }
  8. public bool Enabled { get; set; }
  9. public List<string> ChannelBlacklist { get; set; }
  10. public List<string> NickBlacklist { get; set; }
  11. public List<string> Triggers { get; set; }
  12. public List<CommandArgument> Arguments { get; set; }
  13. public List<AccessType> AllowedAccess { get; set; }
  14. public bool ShowHelp { get; set; }
  15. public bool SpamCheck { get; set; }
  16. public bool ShouldSerializeValue()
  17. {
  18. return false;
  19. }
  20. public Command()
  21. {
  22. SetDefaults();
  23. }
  24. public void SetDefaults()
  25. {
  26. Name = string.Empty;
  27. Description = string.Empty;
  28. Enabled = true;
  29. Triggers = new List<string>();
  30. ChannelBlacklist = new List<string>();
  31. NickBlacklist = new List<string>();
  32. Arguments = new List<CommandArgument>();
  33. AllowedAccess = new List<AccessType>();
  34. ShowHelp = true;
  35. SpamCheck = true;
  36. }
  37. public void Copy(Command command)
  38. {
  39. Name = command.Name;
  40. Description = command.Description;
  41. Enabled = command.Enabled;
  42. Triggers = new List<string>();
  43. foreach (string trigger in command.Triggers)
  44. {
  45. Triggers.Add(trigger);
  46. }
  47. ChannelBlacklist = new List<string>();
  48. foreach (string channel in command.ChannelBlacklist)
  49. {
  50. ChannelBlacklist.Add(channel);
  51. }
  52. NickBlacklist = new List<string>();
  53. foreach (string nick in command.NickBlacklist)
  54. {
  55. NickBlacklist.Add(nick);
  56. }
  57. Arguments = new List<CommandArgument>();
  58. foreach (CommandArgument arg in command.Arguments)
  59. {
  60. CommandArgument newArg = new CommandArgument();
  61. newArg.Copy(arg);
  62. Arguments.Add(newArg);
  63. }
  64. AllowedAccess = new List<AccessType>();
  65. foreach (AccessType accessType in command.AllowedAccess)
  66. {
  67. AllowedAccess.Add(accessType);
  68. }
  69. ShowHelp = command.ShowHelp;
  70. SpamCheck = command.SpamCheck;
  71. }
  72. }
  73. }