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.

IRCTypes.cs 7.9KB

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