The easy to use and full featured Irc Bot everyone is talking about!
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Command.cs 2.3KB

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