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 9.1KB

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