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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.ComponentModel;
  7. namespace Combot
  8. {
  9. public enum ErrorType
  10. {
  11. Bot = 0,
  12. TCP = 1,
  13. IRC = 2,
  14. Framework = 3
  15. }
  16. public enum MessageType
  17. {
  18. Service = 0,
  19. Channel = 1,
  20. Query = 2
  21. }
  22. public enum ChannelMode
  23. {
  24. [Description("Admin")]
  25. a,
  26. [Description("Admin Only")]
  27. A,
  28. [Description("Ban")]
  29. b,
  30. [Description("Colourless")]
  31. c,
  32. [Description("No CTCP")]
  33. C,
  34. [Description("Ban Exempt")]
  35. e,
  36. [Description("Flood Protection")]
  37. f,
  38. [Description("HalfOp")]
  39. h,
  40. [Description("Invite Only")]
  41. i,
  42. [Description("Invite Exempt")]
  43. I,
  44. [Description("Join Throttling")]
  45. j,
  46. [Description("Key")]
  47. k,
  48. [Description("No KNOCK")]
  49. K,
  50. [Description("Limit")]
  51. l,
  52. [Description("Link")]
  53. L,
  54. [Description("Moderated")]
  55. m,
  56. [Description("Registered Nicks May Talk")]
  57. M,
  58. [Description("No External Messages")]
  59. n,
  60. [Description("No Nickname Changes")]
  61. N,
  62. [Description("Operator")]
  63. o,
  64. [Description("Oper Only")]
  65. O,
  66. [Description("Private")]
  67. p,
  68. [Description("Owner")]
  69. q,
  70. [Description("No Kicks Allowed")]
  71. Q,
  72. [Description("Registered")]
  73. r,
  74. [Description("Registered Only")]
  75. R,
  76. [Description("Secret")]
  77. s,
  78. [Description("Strip Mirc Colors")]
  79. S,
  80. [Description("+hoaq Only Topic Change")]
  81. t,
  82. [Description("No Notices")]
  83. T,
  84. [Description("Auditorium")]
  85. u,
  86. [Description("Voice")]
  87. v,
  88. [Description("No Invite")]
  89. V,
  90. [Description("Secure Only")]
  91. z
  92. }
  93. public enum UserMode
  94. {
  95. [Description("Service Administrator")]
  96. a,
  97. [Description("Service Administrator")]
  98. A,
  99. [Description("Bot")]
  100. B,
  101. [Description("Connection Notice")]
  102. c,
  103. [Description("C-oAdministrator")]
  104. C,
  105. [Description("Deaf")]
  106. d,
  107. [Description("View 'Eyes' Server Messages")]
  108. e,
  109. [Description("Flood Alerts")]
  110. f,
  111. [Description("Remote Server Connection Notice")]
  112. F,
  113. [Description("GlobOp and LocOp Messages")]
  114. g,
  115. [Description("Censored")]
  116. G,
  117. [Description("Helpful")]
  118. h,
  119. [Description("Hide IRCop Status")]
  120. H,
  121. [Description("Invisible")]
  122. i,
  123. [Description("Junk Messages")]
  124. j,
  125. [Description("Kill Messages")]
  126. k,
  127. [Description("Nick Change Notice")]
  128. n,
  129. [Description("Network Administrator")]
  130. N,
  131. [Description("Global Operator")]
  132. o,
  133. [Description("Local Operator")]
  134. O,
  135. [Description("Hide All Channels")]
  136. p,
  137. [Description("U:Lines Only")]
  138. q,
  139. [Description("Registered")]
  140. r,
  141. [Description("Registered Messages Only")]
  142. R,
  143. [Description("Server Notices")]
  144. s,
  145. [Description("Services Only")]
  146. S,
  147. [Description("VHost")]
  148. t,
  149. [Description("No CTCP")]
  150. T,
  151. [Description("Receive Bad DCC")]
  152. v,
  153. [Description("WebTV User")]
  154. V,
  155. [Description("Wallops")]
  156. w,
  157. [Description("Whois Notice")]
  158. W,
  159. [Description("Hidden Hostname")]
  160. x,
  161. [Description("Secure Connection")]
  162. z
  163. }
  164. public class BotError
  165. {
  166. public ErrorType Type { get; set; }
  167. public string Message { get; set; }
  168. }
  169. public class Nick
  170. {
  171. public string Realname { get; set; }
  172. public string Host { get; set; }
  173. public string Nickname { get; set; }
  174. public bool Identified { get; set; }
  175. public bool Registered { get; set; }
  176. public List<UserMode> Modes { get; set; }
  177. public Nick()
  178. {
  179. Realname = string.Empty;
  180. Host = string.Empty;
  181. Nickname = string.Empty;
  182. Identified = false;
  183. Registered = false;
  184. Modes = new List<UserMode>();
  185. }
  186. public Nick(string realname, string host, string nickname, bool identified, bool registered, List<UserMode> modes)
  187. {
  188. Realname = realname;
  189. Host = host;
  190. Nickname = nickname;
  191. Identified = identified;
  192. Registered = registered;
  193. Modes = modes;
  194. }
  195. public void AddMode(UserMode mode)
  196. {
  197. Modes.Add(mode);
  198. }
  199. public void AddModes(List<UserMode> modes)
  200. {
  201. Modes.AddRange(modes);
  202. }
  203. public void RemoveMode(UserMode mode)
  204. {
  205. if (Modes.Contains(mode))
  206. {
  207. Modes.Remove(mode);
  208. }
  209. }
  210. public void RemoveModes(List<UserMode> modes)
  211. {
  212. foreach (UserMode mode in modes)
  213. {
  214. RemoveMode(mode);
  215. }
  216. }
  217. }
  218. public class Channel
  219. {
  220. public string Name { get; set; }
  221. public string Topic { get; set; }
  222. public DateTime Registration { get; set; }
  223. public List<ChannelMode> Modes { get; set; }
  224. public List<Nick> Nicks { get; set; }
  225. public Channel()
  226. {
  227. Name = string.Empty;
  228. Topic = string.Empty;
  229. Registration = DateTime.Now;
  230. Modes = new List<ChannelMode>();
  231. Nicks = new List<Nick>();
  232. }
  233. public Channel(string name, string topic, DateTime registration, List<ChannelMode> modes, List<Nick> nicks)
  234. {
  235. Name = name;
  236. Topic = topic;
  237. Registration = registration;
  238. Modes = modes;
  239. Nicks = nicks;
  240. }
  241. public void AddNick(Nick nick)
  242. {
  243. Nicks.Add(nick);
  244. }
  245. public void AddNicks(List<Nick> nicks)
  246. {
  247. Nicks.AddRange(nicks);
  248. }
  249. public void RemoveNick(Nick nick)
  250. {
  251. if (Nicks.Contains(nick))
  252. {
  253. Nicks.Remove(nick);
  254. }
  255. }
  256. public void RemoveNicks(List<Nick> nicks)
  257. {
  258. foreach (Nick nick in nicks)
  259. {
  260. RemoveNick(nick);
  261. }
  262. }
  263. public void AddMode(ChannelMode mode)
  264. {
  265. Modes.Add(mode);
  266. }
  267. public void AddModes(List<ChannelMode> modes)
  268. {
  269. Modes.AddRange(modes);
  270. }
  271. public void RemoveMode(ChannelMode mode)
  272. {
  273. if (Modes.Contains(mode))
  274. {
  275. Modes.Remove(mode);
  276. }
  277. }
  278. public void RemoveModes(List<ChannelMode> modes)
  279. {
  280. foreach (ChannelMode mode in modes)
  281. {
  282. RemoveMode(mode);
  283. }
  284. }
  285. }
  286. public class Message
  287. {
  288. public MessageType Type { get; set; }
  289. public Nick Sender { get; set; }
  290. public Nick Receiver { get; set; }
  291. public Channel Channel { get; set; }
  292. public string Message { get; set; }
  293. }
  294. }