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.

113 lines
3.0KB

  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. namespace ProjectGolan.Vrobot3.Modules
  15. {
  16. //
  17. // Mod_Fun
  18. //
  19. public class Mod_Fun : IBotModule
  20. {
  21. //
  22. // ShitpostingDevice
  23. //
  24. private class ShitpostingDevice
  25. {
  26. private String word, final;
  27. private Random rnd = Utils.GetRND();
  28. private int min, max;
  29. private Bot bot;
  30. //
  31. // ShitpostingDevice constructor
  32. //
  33. public ShitpostingDevice(String word, String final, int min, int max,
  34. Bot bot)
  35. {
  36. this.word = word;
  37. this.final = final;
  38. this.min = min;
  39. this.max = max;
  40. this.bot = bot;
  41. }
  42. //
  43. // run
  44. //
  45. public void run(User usr, Channel channel, String msg)
  46. {
  47. var n = rnd.Next(min, max);
  48. var outp = String.Empty;
  49. if(bot.clientInfo.hasColors && rnd.Next(0, 8) == 1)
  50. for(int i = 0; i < 6; i++)
  51. {
  52. String[] colors = { "04", "07", "08", "09", "12", "06" };
  53. outp += "\x03";
  54. outp += colors[i];
  55. outp += word;
  56. outp += word;
  57. }
  58. else
  59. for(var i = 0; i < n; i++)
  60. outp += word;
  61. bot.reply(usr, channel, outp + final);
  62. }
  63. }
  64. //
  65. // Mod_Fun constructor
  66. //
  67. public Mod_Fun(Bot bot) :
  68. base(bot)
  69. {
  70. commands["carmack"] = new BotCommandStructure{
  71. cmd = new ShitpostingDevice("MM", "", 3, 20, bot).run,
  72. flags = BotCommandFlags.Hidden
  73. };
  74. commands["revenant"] = new BotCommandStructure{
  75. cmd = new ShitpostingDevice("AA", "", 3, 20, bot).run,
  76. flags = BotCommandFlags.Hidden
  77. };
  78. commands["wan"] = new BotCommandStructure{
  79. cmd = new ShitpostingDevice("wan ", "- !", 2, 12, bot).run,
  80. flags = BotCommandFlags.Hidden
  81. };
  82. commands["nyan"] = new BotCommandStructure{
  83. cmd = new ShitpostingDevice("nyan ", "!~", 2, 12, bot).run,
  84. flags = BotCommandFlags.Hidden
  85. };
  86. commands[":^)"] = new BotCommandStructure{
  87. cmd = (usr, channel, msg) => bot.message(channel, ":^)"),
  88. flags = BotCommandFlags.Hidden
  89. };
  90. events.onMessage += onMessage;
  91. }
  92. //
  93. // onMessage
  94. //
  95. public void onMessage(User usr, Channel channel, String msg)
  96. {
  97. if(msg.Contains("OLD MEN"))
  98. bot.message(channel, "WARNING! WARNING!");
  99. }
  100. }
  101. }
  102. // EOF