Sha256: addffb9a64798ca82b7cdd00d451223636e6c5536209f74a2aa94dc2add48dd8
Contents?: true
Size: 735 Bytes
Versions: 4
Compression:
Stored size: 735 Bytes
Contents
# encoding=utf-8 # frozen_string_literal: true module OPQ class PluginBase def receive_qq(qq, msg) ;end def receive_group(qq, msg);end end class PluginLoader attr_accessor :plugins def load_all(plugin_dir) puts "[BOT] 正在加载插件,请稍等~" @plugins = [] Dir.glob(File.join(plugin_dir, '*.rb')).each do |plugin_file| $LOAD_PATH.unshift(plugin_dir) Kernel.load(plugin_file) plugin_name = File.basename(plugin_file, '.rb').capitalize plugin_class = Object.const_get("#{plugin_name}") @plugins << plugin_class.new end puts "[BOT] 插件加载完毕!" + @plugins.map { |p| p.class.name}.to_s end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
opqr-0.1.5 | lib/opqr/plugin.rb |
opqr-0.1.4 | lib/opqr/plugin.rb |
opqr-0.1.3 | lib/opqr/plugin.rb |
opqr-0.1.2 | lib/opqr/plugin.rb |