Class: Cinch::BotTemplate::Templates::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/cinch/bot_template/templates/plugin.rb

Class Method Summary collapse

Class Method Details

.generate(plugin_names:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cinch/bot_template/templates/plugin.rb', line 7

def Plugin.generate(plugin_names:)
  plugins = {}
  plugin_names.each do |plugin|
    name = "#{plugin.capitalize}Plugin"

    bot = "    class \#{name}\n      include Cinch::Plugin\n      match /^hello$/, method: :hello_world\n      # @param [Cinch::Message] m cinch message object\n      def hello_world(m)\n        m.reply \"Hello \\\#{m.user.nick}\"\n      end\n    end\n    BOT\n    plugins[plugin+'.rb'] = bot\n\n  end\n  plugins\nend\n"