Advertisement
Guest User

NomBotV3.2.5 Source

a guest
Jul 22nd, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.85 KB | None | 0 0
  1. using Discord.Commands;
  2. using Discord;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Discord.Modules;
  9.  
  10.  
  11. /// <summary>
  12. /// PM PROOFING
  13. ///
  14. /// if (e.Channel.IsPrivate == true){ } else { (THE COMMAND HERE) }
  15. ///
  16. /// </summary>
  17.  
  18.  
  19.  
  20. namespace NomBotV2
  21. {
  22.  
  23. class NomBotV2
  24. {
  25. DiscordClient discord;
  26. string x;
  27. string y;
  28. string inputa="";
  29. string inputb="";
  30. float a;
  31. float b;
  32. float c;
  33. long factora;
  34. long factorb;
  35. long factorc;
  36. string game = "";
  37. long nom= 204441911489069056;
  38. int totalscore;
  39. string rank;
  40. int score;
  41. string spamnew="fin";
  42. string spamold="start";
  43. new string newuser = "";
  44. new string olduser = "";
  45. string censorID;
  46.  
  47. // Realm of NomBot Server ID: 299653823503400960
  48. // Paradox Infinity Server ID: 233717585605033984
  49. // Nom's Server ID: 254302003188989953
  50.  
  51. public NomBotV2()
  52. {
  53. discord = new DiscordClient(x => { x.LogHandler = Log; x.LogLevel = LogSeverity.Info; });
  54.  
  55. discord.UsingCommands(x =>
  56. {
  57. x.PrefixChar = '~';
  58. x.AllowMentionPrefix = true;
  59. });
  60.  
  61.  
  62. var commands = discord.GetService<CommandService>();
  63.  
  64.  
  65.  
  66.  
  67.  
  68. commands.CreateCommand("censor").Parameter("censorID").Do(async (e) =>
  69. {
  70. if (e.User.Id == 204441911489069056)
  71. {
  72. censorID = e.GetArg("censorID");
  73. }
  74. });
  75.  
  76. // Spam Filter
  77.  
  78. discord.MessageReceived += async (s, e) =>
  79. {
  80.  
  81. if (e.User.IsBot)
  82. { }
  83. else
  84. {
  85. var channel = e.Server.FindChannels("general", ChannelType.Text).FirstOrDefault();
  86. var user = discord.CurrentUser;
  87. spamold = spamnew;
  88. Message[] messagesToObtain;
  89. messagesToObtain = await e.Channel.DownloadMessages(2);
  90. spamnew = messagesToObtain[0].Text;
  91. if (spamnew == spamold)
  92. {
  93. Message[] messagesToDelete;
  94. messagesToDelete = await e.Channel.DownloadMessages(1);
  95. await e.Channel.DeleteMessages(messagesToDelete);
  96. // TESTING TEXT SENDING COMMANDS
  97.  
  98. // await e.Channel.SendMessage(messagesToDelete.ToString());
  99. // await e.Channel.SendMessage(spamnew);
  100. // await e.Channel.SendMessage(spamold);
  101. }
  102. else
  103. {
  104. if (messagesToObtain[0].User.Id.ToString() == censorID)
  105. {
  106. Message[] messagesToDelete;
  107. messagesToDelete = await e.Channel.DownloadMessages(1);
  108. await e.Channel.DeleteMessages(messagesToDelete);
  109. }
  110. };
  111. }
  112.  
  113.  
  114. };
  115.  
  116. // COMMANDS
  117.  
  118. // To add a simple text command, use the following format:
  119. /*/
  120. commands.CreateCommand("")
  121. .Do(async (e) =>
  122. {
  123. await e.Channel.SendMessage("");
  124. });
  125. /*/
  126. discord.UserJoined += async (s, e) =>
  127. {
  128.  
  129. var channel = e.Server.FindChannels("general", ChannelType.Text).FirstOrDefault();
  130. var user = discord.CurrentUser;
  131. if (e.Server.Id == 233717585605033984)
  132. {
  133. await channel.SendMessage(string.Format("Welcome to the Paradox Infinity Server ", user.Mention, "!"));
  134. }
  135. if (e.Server.Id == 254302003188989953)
  136. {
  137. await channel.SendMessage(string.Format("Welcome to Nom's Server ", user.Mention, "!"));
  138. }
  139.  
  140. if (e.Server.Id == 299653823503400960)
  141. {
  142. await channel.SendMessage(string.Format("Welcome to the Realm of NomBot Server; Please PM Nom for the ability to recommend things! ", string.Format(user.Name), "!"));
  143. Role Spectator = null;
  144. //await user.AddRoles(Spectator);
  145. }
  146. };
  147.  
  148. commands.CreateCommand("pfft")
  149. .Do(async (e) =>
  150. {
  151. if (e.Channel.IsPrivate == true) { }
  152. else
  153. {
  154. await e.Channel.SendMessage("https://ifunny.co/fun/J4RIgcX44"); }
  155. });
  156. /*/ Channel.Client.UserJoined += async (s, e) =>
  157. {
  158. Discord.Role Spectator = null;
  159. await e.User.AddRoles(Spectator);
  160. }; ; /*/
  161.  
  162.  
  163.  
  164.  
  165.  
  166. commands.CreateCommand("startup").Do((e) =>
  167. {
  168. if (e.Channel.IsPrivate == true) { }
  169. else
  170. {
  171. e.User.Server.Client.SetGame("with atom bombs.");
  172. }
  173. });
  174. commands.CreateCommand("~").Do(async (e) =>
  175. {
  176. if (e.Channel.IsPrivate == true) { }
  177. else
  178. {
  179. await e.Channel.SendMessage("Are you broken?");
  180. }
  181. });
  182.  
  183.  
  184.  
  185.  
  186. // RANK SYSTEM
  187. commands.CreateCommand("rank").Do((e) =>
  188. {
  189.  
  190. ;
  191. });
  192.  
  193. discord.MessageReceived += (s, e) =>
  194. {
  195. rank = rank + e.User.Id;
  196. };
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207. //
  208.  
  209.  
  210. //
  211.  
  212. commands.CreateCommand("tatsumaki")
  213. .Do(async (e) =>
  214. {
  215. await e.Channel.SendMessage("Boy, I sure do hate @Tatsumaki 's Japanese guts!");
  216. });
  217. commands.CreateCommand("hi")
  218. .Do(async (e) =>
  219. {
  220. await e.Channel.SendMessage("Hi! I'm NomBot! I'm a random creation of Zomon333 to test stuff like his coding skills! Use ~help or ~commands for more info!");
  221. });
  222.  
  223. commands.CreateCommand("info1")
  224. .Do(async (e) =>
  225. {
  226. await e.Channel.SendMessage("This bot was made by Zomon333 using the Discord API in C#, a language that Zomon has technically never learned. (Use ~info2 for more)");
  227. });
  228. commands.CreateCommand("info2")
  229. .Do(async (e) =>
  230. {
  231. await e.Channel.SendMessage("Primarily a test, this bot will eventually have loads of fun features including but not limited to simple math, image sharing, cheezy jokes. (Use ~info3 for more)");
  232. });
  233. commands.CreateCommand("info3")
  234. .Do(async (e) =>
  235. {
  236. await e.Channel.SendMessage("To further exacerbate the cheezy jokes, this bot was also created to throw automated insults at specific people in specific discord servers. Whether or not this will be implemented is yet to be determined.");
  237. });
  238. commands.CreateCommand("nomsucks")
  239. .Do(async (e) =>
  240. {
  241. await e.Channel.SendMessage("Fuck off.");
  242. });
  243. commands.CreateCommand("jerry")
  244. .Do(async (e) =>
  245. {
  246. await e.Channel.SendMessage("OH, FUCK ME JERRY!");
  247. });
  248. commands.CreateCommand("nom")
  249. .Do(async (e) =>
  250. {
  251. await e.Channel.SendMessage("Uber mecha nazi hitler on steroids with an antifreeze flamethrower and diagrams for an atom bomb.");
  252. });
  253. commands.CreateCommand("flam")
  254. .Do(async (e) =>
  255. {
  256. await e.Channel.SendMessage("THE DOCTOR IS IN THE HOUSE. EVERYBODY STEP BACK, HE'LL PROBABLY KILL SOMEBODY.");
  257. });
  258. commands.CreateCommand("hands")
  259. .Do(async (e) =>
  260. {
  261. await e.Channel.SendMessage("http://www.greatdreams.com/war/black_hole.jpg ; This is a hole through which I collect millions of baby hands.");
  262. });
  263. commands.CreateCommand("white")
  264. .Do(async (e) =>
  265. {
  266. await e.Channel.SendMessage("Whities gotta pay. And the payment is baby hands.");
  267. });
  268. commands.CreateCommand("forgive")
  269. .Do(async (e) =>
  270. {
  271. await e.Channel.SendMessage(" ' That's the sound of forgiveness!' 'No, that's the sound of people drowning Carl' 'That's also what forgiveness sounds like! Screaming and then silence!' ");
  272. });
  273. commands.CreateCommand("boat")
  274. .Do(async (e) =>
  275. {
  276. await e.Channel.SendMessage("Boat nectarrrrrr");
  277. });
  278. commands.CreateCommand("resist")
  279. .Do(async (e) =>
  280. {
  281. await e.Channel.SendMessage("VIVE LE RESISTANCE");
  282. });
  283. commands.CreateCommand("pig")
  284. .Do(async (e) =>
  285. {
  286. await e.Channel.SendMessage("NuclearPigz is *swine*. He's the bane of my existance!");
  287. });
  288. commands.CreateCommand("bunny")
  289. .Do(async (e) =>
  290. {
  291. await e.Channel.SendMessage(":rabbit:");
  292. });
  293. commands.CreateCommand("cat")
  294. .Do(async (e) =>
  295. {
  296. await e.Channel.SendMessage("Meow");
  297. });
  298. commands.CreateCommand("dog")
  299. .Do(async (e) =>
  300. {
  301. await e.Channel.SendMessage("Woof");
  302. });
  303. commands.CreateCommand("doge")
  304. .Do(async (e) =>
  305. {
  306. await e.Channel.SendMessage("https://i.ytimg.com/vi/Nl5r-uoB2C4/maxresdefault.jpg");
  307. });
  308.  
  309.  
  310.  
  311. // Displays opinion about select people
  312. commands.CreateCommand("fren")
  313. .Do(async (e) =>
  314. {
  315. if (e.User.Id == 204441911489069056)
  316. {
  317. await e.Channel.SendMessage("Yas Nom Iz Fren");
  318. }
  319. else
  320. {
  321. if (e.User.Id == 239151547320238080)
  322. {
  323. await e.Channel.SendMessage("Yas Flam be fren");
  324. }
  325. if (e.User.Id == 234516941593772033)
  326. {
  327. await e.Channel.SendMessage("NU. NUKZ NO BE FREN FILTHEH PIGGEH.");
  328. }
  329. if (e.User.Id == 227539180648005633)
  330. {
  331. await e.Channel.SendMessage("Silly wabbit, Of course you're the friend of NomBot!");
  332. }
  333. if (e.User.Id == 214602261198929920)
  334. {
  335. await e.Channel.SendMessage("*ignores Kaotic*");
  336. }
  337. if (e.User.Id == 247917427222904832)
  338. {
  339. await e.Channel.SendMessage("kekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekekek");
  340. }
  341. if (e.User.Id == 136869144816517120)
  342. {
  343. await e.Channel.SendMessage("danny BOIIIIIIIIIIIIIIIIIII");
  344. }
  345. if (e.User.Id == 168171650137849856)
  346. {
  347. await e.Channel.SendMessage("Sure, why not. Can't see what could go wrong... ");
  348. }
  349. if (e.User.Id == 233719574544121866)
  350. {
  351. await e.Channel.SendMessage("HAHAHAHAHAHAHAHAHAHAHHAHAHH... Clearly you don't know me! Or do you :3");
  352. }
  353. if (e.User.Id == 136869144816517120)
  354. {
  355. await e.Channel.SendMessage("You are so retarted, I'm surprised you could even find the damned enter key. I hope you die by drowning in your own fecal matter.");
  356. }
  357. if (e.User.Id == 241749258875830272)
  358. {
  359. await e.Channel.SendMessage("I hope you die.");
  360. }
  361. if (e.User.Id == 308946843642101761)
  362. {
  363. await e.Channel.SendMessage("Chicken of the sea.");
  364. }
  365. if (e.User.Id == 288777229037731842)
  366. {
  367. await e.Channel.SendMessage("DIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIEDIE");
  368. }
  369. }
  370.  
  371. });
  372.  
  373. // Obscene Holocaust Joke
  374. commands.CreateCommand("holo")
  375. .Do(async (e) =>
  376. {
  377. await e.Channel.SendMessage(":fire: CAUST https://cdn-www.terminix.com/cs/ahs/image/right-oven-for-kitchen.jpg");
  378. });
  379. commands.CreateCommand("kkk")
  380. .Do(async (e) =>
  381. {
  382. await e.Channel.SendMessage("LINCH THE BLACKSLINCH THE BLACKSLINCH THE BLACKSLINCH THE BLACKSLINCH THE BLACKSLINCH THE BLACKSLINCH THE BLACKSLINCH THE BLACKSLINCH THE BLACKS");
  383. });
  384. commands.CreateCommand("daniel")
  385. .Do(async (e) =>
  386. {
  387. await e.Channel.SendMessage("https://www.youtube.com/watch?v=UDYMUd4X_aA");
  388. });
  389. commands.CreateCommand("jew")
  390. .Do(async (e) =>
  391. {
  392. await e.Channel.SendMessage(":fire: :star_of_david: :fire:");
  393. });
  394.  
  395. //
  396.  
  397. commands.CreateCommand("bun")
  398. .Do(async (e) =>
  399. {
  400. await e.Channel.SendMessage("https://cdn.discordapp.com/attachments/233717585605033984/312047412979957780/unknown.png");
  401.  
  402. //
  403.  
  404. });
  405. commands.CreateCommand("")
  406. .Do(async (e) =>
  407. {
  408. await e.Channel.SendMessage("");
  409. });
  410.  
  411.  
  412. // Informs people of helpful commands
  413. commands.CreateCommand("help")
  414. .Do(async (e) =>
  415. {
  416. await e.Channel.SendMessage("Use ~info[1-3], or ~commands");
  417. });
  418. // Lists Non-Secret Commands
  419. commands.CreateCommand("commands")
  420. .Do(async (e) =>
  421. {
  422. await e.Channel.SendMessage("Commands: ~add, ~sub, ~div, ~mult, ~fact, ~help, ~responsible, ~holo, ~fren, ~doge, ~dog, ~cat, ~bunny, ~pig, ~resist, ~boat, ~forgive, ~hands, ~white, ~flam, ~nom, ~jerry, ~nomsucks, ~kaotic, ~info1, ~info2, ~info3, ~hi, ~grandprize, ~sped");
  423. });
  424. // Lists Responsible Quote
  425. commands.CreateCommand("responsible")
  426. .Do(async (e) =>
  427. {
  428. await e.Channel.SendMessage(" ' I'm glad you were responsible for once ' (continues to add more chaotic commands)");
  429. });
  430. // Lists Kaotic Joke
  431. commands.CreateCommand("kaotic")
  432. .Do(async (e) =>
  433. {
  434. await e.Channel.SendMessage("Actually rather tame. http://static.boredpanda.com/blog/wp-content/uploads/2016/08/cute-kittens-30-57b30ad41bc90__605.jpg");
  435. });
  436. // Questionable Commands
  437.  
  438. commands.CreateCommand("grandprize")
  439. .Do(async (e) =>
  440. {
  441. await e.Channel.SendMessage("Here's your 'Prize' : http://imgur.com/SNe7ZRS");
  442. });
  443. commands.CreateCommand("sped")
  444. .Do(async (e) =>
  445. {
  446. await e.Channel.SendMessage("Toasty Jenessa; http://i.imgur.com/LesDUeQ.jpg ");
  447. await e.Channel.SendMessage("You fucking sped, burn in my toasty hitlery oven!");
  448. });
  449.  
  450. discord.UserIsTyping += async (s, e) =>
  451. {
  452. e.User.Server.Client.SetGame("with atom bombs.");
  453. };
  454. commands.CreateCommand("faggot").Do(async (e) =>
  455. {
  456. await e.Channel.SendMessage("http://combiboilersleeds.com/images/sticks/sticks-2.jpg");
  457. // await e.Channel.SendMessage("http://i.imgur.com/YYviard.png");
  458. });
  459. commands.CreateCommand("kys").Do(async (e) =>
  460. {
  461. await e.Channel.SendMessage("https://www.youtube.com/watch?v=ByC8sRdL-Ro");
  462. });
  463. /*/ discord.MessageReceived += (s, e) =>
  464. {
  465. string User = e.User.Name;
  466. list.Add(User);
  467. };
  468. commands.CreateCommand("rank").Do((e) =>
  469. {
  470. string User = e.User.Name;
  471.  
  472. foreach (string names in list){
  473.  
  474. if (names == User)
  475. {
  476. totalscore= totalscore + 1;
  477. }
  478.  
  479. }
  480.  
  481. e.Channel.SendMessage(ToString(totalscore));
  482. });/*/
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489. /*/ BrownTrout commands /*/
  490.  
  491. commands.CreateCommand("joke")
  492. .Do(async (e)=> {
  493. await e.Channel.SendMessage("Why did the bubblegum cross the road? ~");
  494. await e.Channel.SendMessage("~ *Because it was stuck to the chicken's foot*");
  495. });
  496. // commands.CreateCommand("who's awesome?")
  497. // .Do(async (e) =>
  498. // {
  499. // await e.Channel.SendMessage("Flappeh!");
  500. // });
  501. commands.CreateCommand("canser")
  502. .Do(async (e) =>
  503. {
  504. await e.Channel.SendMessage("http://ll-media.tmz.com/2014/12/09/mariah-carey-200x250.jpg");
  505. await e.Channel.SendMessage("Mariah Carey!");
  506. });
  507.  
  508. /*/ Math Commands /*/
  509.  
  510. // Addition
  511. commands.CreateCommand("add" + x + y)
  512. .Parameter("Target1", ParameterType.Required)
  513. .Parameter("Target2", ParameterType.Optional)
  514. .Do(async (e) =>
  515. {
  516. inputa= e.GetArg("Target1");
  517. inputb = e.GetArg("Target2");
  518. a = float.Parse(inputa);
  519. b = float.Parse(inputb);
  520. c = a + b;
  521. await e.Channel.SendMessage("Your result is " + c);
  522. });
  523. // Division
  524. commands.CreateCommand("div" + x + y)
  525. .Parameter("Target1", ParameterType.Required)
  526. .Parameter("Target2", ParameterType.Optional)
  527. .Do(async (e) =>
  528. {
  529. inputa = e.GetArg("Target1");
  530. inputb = e.GetArg("Target2");
  531. a = float.Parse(inputa);
  532. b = float.Parse(inputb);
  533. c = a/b;
  534. await e.Channel.SendMessage("Your result is " + c);
  535. });
  536. // Multiplication
  537. commands.CreateCommand("mult" + x + y)
  538. .Parameter("Target1", ParameterType.Required)
  539. .Parameter("Target2", ParameterType.Optional)
  540. .Do(async (e) =>
  541. {
  542. inputa = e.GetArg("Target1");
  543. inputb = e.GetArg("Target2");
  544. a = float.Parse(inputa);
  545. b = float.Parse(inputb);
  546. c = a*b;
  547. await e.Channel.SendMessage("Your result is " + c);
  548. });
  549. // Subtraction
  550. commands.CreateCommand("sub" + x + y)
  551. .Parameter("Target1", ParameterType.Required)
  552. .Parameter("Target2", ParameterType.Optional)
  553. .Do(async (e) =>
  554. {
  555. inputa = e.GetArg("Target1");
  556. inputb = e.GetArg("Target2");
  557. a = float.Parse(inputa);
  558. b = float.Parse(inputb);
  559. c = a - b;
  560. await e.Channel.SendMessage("Your result is " + c);
  561. });
  562. // Factorialization
  563. commands.CreateCommand("fact" + x)
  564. .Parameter("Target1", ParameterType.Required)
  565. .Do(async (e) =>
  566. {
  567. inputa = e.GetArg("Target1");
  568. factora = long.Parse(inputa);
  569. factorc = factora;
  570. if (factora > 0)
  571. {
  572. if (factora != 0)
  573. {
  574. if (factora <= 25)
  575. {
  576. while (factorc >= 2)
  577. {
  578. factorb = factorc - 1;
  579. factorc = factorc - 1;
  580. factora = factora * factorb;
  581. }
  582. }
  583. else
  584. {
  585. await e.Channel.SendMessage("Technical capabilities disallow the display of digits longer than the answer to this factorialized number. Please try again.");
  586. }
  587. }
  588.  
  589. if (factorc <= 25)
  590. {
  591. await e.Channel.SendMessage("Your result is " + factora);
  592. }
  593. else
  594. { }
  595. }
  596. else
  597. {
  598. if (factora == 0)
  599. {
  600. await e.Channel.SendMessage("Your result is 1");
  601. }
  602. else
  603. {
  604. await e.Channel.SendMessage("Cannot factorialize negative numbers.");
  605. }
  606. }
  607. });
  608.  
  609.  
  610.  
  611.  
  612.  
  613. // Channel Join
  614. discord.ExecuteAndWait(async () =>
  615. {
  616. await discord.Connect("Mjk5MzQ2MjcxNjg3Mjc4NTky.C8co-Q.s7Si64W5BlnWOShu8ZmyPxemvH4", TokenType.Bot);
  617. restartmethodxd();
  618. }); }
  619.  
  620. private void restartmethodxd()
  621. {
  622. throw new NotImplementedException();
  623. }
  624.  
  625. private string ToString(User user)
  626. {
  627. throw new NotImplementedException();
  628. }
  629.  
  630. private void Client_MessageReceived(object sender, MessageEventArgs e)
  631. {
  632. throw new NotImplementedException();
  633. }
  634.  
  635.  
  636. // Idk
  637. private string ToString(float result)
  638. {
  639. throw new NotImplementedException();
  640. }
  641. // Message Logging for Bot Access
  642. private void Log(object sender, LogMessageEventArgs e)
  643. {
  644. Console.WriteLine(e.Message);
  645. }
  646.  
  647. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement