Advertisement
Guest User

bot

a guest
Jun 29th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. require 'cinch'
  2.  
  3. class Rand
  4. include Cinch::Plugin
  5.  
  6. match(/rand\s*(-?)(\d+)\.\.(-?)(\d+)/, method: :by_range)
  7. match(/rand\s*$/, method: :default)
  8.  
  9. def by_range(m, min_m = "", min=0, max_m = "", max=1)
  10. min = min.to_i
  11. max = max.to_i
  12.  
  13. min = if min_m == "-" then -min else min end
  14. max = if max_m == "-" then -max else max end
  15.  
  16. if min > max
  17. min, max = max, min
  18. end
  19.  
  20. result = rand min..max
  21. m.reply "#{m.user.nick}: #{result}"
  22. end
  23.  
  24. def default(m)
  25. m.reply "#{m.user.nick}: #{rand 0..1}"
  26. end
  27. end
  28.  
  29. class Choose
  30. include Cinch::Plugin
  31.  
  32. match(/choose\s+(.*)/)
  33.  
  34. def execute(m, args)
  35. puts "Kappa"
  36. args = args.split("/").map(&:strip)
  37. m.reply "#{m.user.nick}: #{args.sample} (danshat негр)"
  38. end
  39. end
  40.  
  41. class Flood
  42. include Cinch::Plugin
  43.  
  44. match "kappa", method: :kappa
  45. match "mico", method: :mico
  46.  
  47. def kappa(m)
  48. m.reply
  49. "░░░░▄▀▀▀▀▀█▀▄▄▄▄░░░░\n" +
  50. "░░▄▀▒▓▒▓▓▒▓▒▒▓▒▓▀▄░░\n" +
  51. "▄▀▒▒▓▒▓▒▒▓▒▓▒▓▓▒▒▓█░\n" +
  52. "█▓▒▓▒▓▒▓▓▓░░░░░░▓▓█░\n" +
  53. "█▓▓▓▓▓▒▓▒░░░░░░░░▓█░\n" +
  54. "▓▓▓▓▓▒░░░░░░░░░░░░█░\n" +
  55. "▓▓▓▓░░░░▄▄▄▄░░░▄█▄▀░\n" +
  56. "░▀▄▓░░▒▀▓▓▒▒░░█▓▒▒░░\n" +
  57. "▀▄░░░░░░░░░░░░▀▄▒▒█░\n" +
  58. "░▀░▀░░░░░▒▒▀▄▄▒▀▒▒█░\n" +
  59. "░░▀░░░░░░▒▄▄▒▄▄▄▒▒█░\n" +
  60. "░░░▀▄▄▒▒░░░░▀▀▒▒▄▀░░\n" +
  61. "░░░░░▀█▄▒▒░░░░▒▄▀░░░\n" +
  62. "░░░░░░░░▀▀█▄▄▄▄▀░░░░"
  63. end
  64.  
  65. def mico(m)
  66. m.reply "за mico!"
  67. end
  68. end
  69.  
  70. bot = Cinch::Bot.new do
  71. configure do |c|
  72. c.server = "irc.esper.net"
  73. c.channels = ["#cc.ru"]
  74. c.plugins.plugins = [Rand, Choose, Flood]
  75. c.plugins.prefix = /^:/
  76. c.nick = "YuRaNnNzZZ"
  77. c.messages_per_second = 9999
  78. c.server_queue_size = 9999
  79. end
  80.  
  81. on :join do |m|
  82. m.reply "o/"
  83. end
  84. end
  85.  
  86. bot.start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement