The easy to use and full featured Irc Bot everyone is talking about!
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

Command.cs 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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<MessageType> AllowedMessageTypes { get; set; }
  14. public List<AccessType> AllowedAccess { get; set; }
  15. public bool ShowHelp { get; set; }
  16. public bool SpamCheck { get; set; }
  17. public bool ShouldSerializeValue()
  18. {
  19. return false;
  20. }
  21. public Command()
  22. {
  23. SetDefaults();
  24. }
  25. public void SetDefaults()
  26. {
  27. Name = string.Empty;
  28. Description = string.Empty;
  29. Enabled = true;
  30. Triggers = new List<string>();
  31. ChannelBlacklist = new List<string>();
  32. NickBlacklist = new List<string>();
  33. Arguments = new List<CommandArgument>();
  34. AllowedMessageTypes = new List<MessageType>();
  35. AllowedAccess = new List<AccessType>();
  36. ShowHelp = true;
  37. SpamCheck = true;
  38. }
  39. public void Copy(Command command)
  40. {
  41. Name = command.Name;
  42. Description = command.Description;
  43. Enabled = command.Enabled;
  44. Triggers = new List<string>();
  45. foreach (string trigger in command.Triggers)
  46. {
  47. Triggers.Add(trigger);
  48. }
  49. ChannelBlacklist = new List<string>();
  50. foreach (string channel in command.ChannelBlacklist)
  51. {
  52. ChannelBlacklist.Add(channel);
  53. }
  54. NickBlacklist = new List<string>();
  55. foreach (string nick in command.NickBlacklist)
  56. {
  57. NickBlacklist.Add(nick);
  58. }
  59. Arguments = new List<CommandArgument>();
  60. foreach (CommandArgument arg in command.Arguments)
  61. {
  62. CommandArgument newArg = new CommandArgument();
  63. newArg.Copy(arg);
  64. Arguments.Add(newArg);
  65. }
  66. AllowedMessageTypes = new List<MessageType>();
  67. foreach (MessageType messageType in command.AllowedMessageTypes)
  68. {
  69. AllowedMessageTypes.Add(messageType);
  70. }
  71. AllowedAccess = new List<AccessType>();
  72. foreach (AccessType accessType in command.AllowedAccess)
  73. {
  74. AllowedAccess.Add(accessType);
  75. }
  76. ShowHelp = command.ShowHelp;
  77. SpamCheck = command.SpamCheck;
  78. }
  79. }
  80. }