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.

Channel.cs 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Combot
  7. {
  8. public class Channel
  9. {
  10. public string Name { get; set; }
  11. public string Topic { get; set; }
  12. public string Key { get; set; }
  13. public bool AutoJoin { get; set; }
  14. public DateTime Registration { get; set; }
  15. public List<ChannelMode> Modes { get; set; }
  16. public List<Nick> Nicks { get; set; }
  17. public Channel()
  18. {
  19. Name = string.Empty;
  20. Topic = string.Empty;
  21. Key = string.Empty;
  22. AutoJoin = false;
  23. Registration = DateTime.Now;
  24. Modes = new List<ChannelMode>();
  25. Nicks = new List<Nick>();
  26. }
  27. public Channel(string name, string topic, string key, bool autojoin, DateTime registration, List<ChannelMode> modes, List<Nick> nicks)
  28. {
  29. Name = name;
  30. Topic = topic;
  31. Key = key;
  32. AutoJoin = autojoin;
  33. Registration = registration;
  34. Modes = modes;
  35. Nicks = nicks;
  36. }
  37. public void AddNick(Nick nick)
  38. {
  39. Nicks.Add(nick);
  40. }
  41. public void AddNicks(List<Nick> nicks)
  42. {
  43. Nicks.AddRange(nicks);
  44. }
  45. public void RemoveNick(Nick nick)
  46. {
  47. if (Nicks.Contains(nick))
  48. {
  49. Nicks.Remove(nick);
  50. }
  51. }
  52. public void RemoveNicks(List<Nick> nicks)
  53. {
  54. foreach (Nick nick in nicks)
  55. {
  56. RemoveNick(nick);
  57. }
  58. }
  59. public void AddMode(ChannelMode mode)
  60. {
  61. Modes.Add(mode);
  62. }
  63. public void AddModes(List<ChannelMode> modes)
  64. {
  65. Modes.AddRange(modes);
  66. }
  67. public void RemoveMode(ChannelMode mode)
  68. {
  69. if (Modes.Contains(mode))
  70. {
  71. Modes.Remove(mode);
  72. }
  73. }
  74. public void RemoveModes(List<ChannelMode> modes)
  75. {
  76. foreach (ChannelMode mode in modes)
  77. {
  78. RemoveMode(mode);
  79. }
  80. }
  81. }
  82. }