vrobot3 is a chat bot for IRC and Discord.
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.

146 lines
3.5KB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // Copyright © 2016 Project Golan
  4. //
  5. // See "LICENSE" for more information.
  6. //
  7. //-----------------------------------------------------------------------------
  8. //
  9. // Fun stuff.
  10. // .carmack, .revenant, .wan, .nyan, .:^)
  11. //
  12. //-----------------------------------------------------------------------------
  13. using System;
  14. using System.Linq;
  15. namespace ProjectGolan.Vrobot3.Modules
  16. {
  17. //
  18. // Mod_Fun
  19. //
  20. public class Mod_Fun : IBotModule
  21. {
  22. //
  23. // ShitpostingDevice
  24. //
  25. private class ShitpostingDevice
  26. {
  27. private String word, final;
  28. private Random rnd = Utils.GetRND();
  29. private int min, max;
  30. private Bot bot;
  31. //
  32. // ShitpostingDevice constructor
  33. //
  34. public ShitpostingDevice(String word, String final, int min, int max,
  35. Bot bot)
  36. {
  37. this.word = word;
  38. this.final = final;
  39. this.min = min;
  40. this.max = max;
  41. this.bot = bot;
  42. }
  43. //
  44. // run
  45. //
  46. public void run(User usr, Channel channel, String msg)
  47. {
  48. var n = rnd.Next(min, max);
  49. var outp = String.Empty;
  50. if(bot.clientInfo.hasColors && rnd.Next(0, 8) == 1)
  51. for(int i = 0; i < 6; i++)
  52. {
  53. String[] colors = { "04", "07", "08", "09", "12", "06" };
  54. outp += "\x03";
  55. outp += colors[i];
  56. outp += word;
  57. outp += word;
  58. }
  59. else
  60. for(var i = 0; i < n; i++)
  61. outp += word;
  62. bot.reply(usr, channel, outp + final);
  63. }
  64. }
  65. //
  66. // Mod_Fun constructor
  67. //
  68. public Mod_Fun(Bot bot) :
  69. base(bot)
  70. {
  71. commands["carmack"] = new BotCommandStructure {
  72. cmd = new ShitpostingDevice("MM", "", 3, 20, bot).run,
  73. hidden = true
  74. };
  75. commands["revenant"] = new BotCommandStructure {
  76. cmd = new ShitpostingDevice("AA", "", 3, 20, bot).run,
  77. hidden = true
  78. };
  79. commands["wan"] = new BotCommandStructure {
  80. cmd = new ShitpostingDevice("wan ", "- !", 2, 12, bot).run,
  81. hidden = true
  82. };
  83. commands["nyan"] = new BotCommandStructure {
  84. cmd = new ShitpostingDevice("nyan ", "!~", 2, 12, bot).run,
  85. hidden = true
  86. };
  87. commands[":^)"] = new BotCommandStructure {
  88. cmd = (usr, channel, msg) => bot.message(channel, ":^)"),
  89. hidden = true
  90. };
  91. // commands["box"] = new BotCommandStructure {
  92. // cmd = cmdBox,
  93. // hidden = true,
  94. // role = BotRole.HalfAdmin
  95. // };
  96. events.onMessage += onMessage;
  97. postSetup();
  98. }
  99. //
  100. // cmdBox
  101. //
  102. // public void cmdBox(User usr, Channel channel, String msg)
  103. // {
  104. // var outp = msg + '\n';
  105. //
  106. // for(var i = 1; i < msg.Length; i++)
  107. // {
  108. // var ln = msg[i].ToString();
  109. // ln = ln.PadRight(msg.Length);
  110. // ln += msg[msg.Length - i];
  111. // outp += ln + '\n';
  112. // }
  113. //
  114. // outp += msg.Reverse();
  115. //
  116. // bot.messageRaw(channel, outp);
  117. // }
  118. //
  119. // onMessage
  120. //
  121. public void onMessage(User usr, Channel channel, String msg)
  122. {
  123. if(msg.Contains("OLD MEN"))
  124. bot.message(channel, "WARNING! WARNING!");
  125. }
  126. }
  127. }
  128. // EOF