Sha256: e940f16e2f7e2756b88ceec93d2a93bf164385546c59a1772af58aae48af712a
Contents?: true
Size: 1.93 KB
Versions: 1
Compression:
Stored size: 1.93 KB
Contents
require 'cocoapods' require 'pathname' require 'pp' require 'tmpdir' require 'json' require 'rainbow' require 'yaml' require 'git' require 'yk_command/analyze/dependency_result' require 'wechat_work_webhook' module YkCommand class WxBot < Thor no_commands do def initialize(config) webhook_url = config[:webhook_url] @project_url = config[:project_url] @project_cover_image_url = config[:project_cover_image_url] @wechat = WechatWorkWebhook.new(webhook_url) end def send_result_to_group(success_list, failed_list) time = Time.new time_s = "#{time.year}-#{time.month}-#{time.day} " @wechat.markdown("## #{time_s} 分析结果\n### 成功 #{success_list.length} 个 #{result_item_list_string(success_list, 'success')}\n### 失败 #{failed_list.length} 个 #{result_item_list_string(failed_list, 'failed')}") end def send_news_to_group require 'wechat_work_webhook' # wechat.text('test', ['@all']) # # <font color=\"DodgerBlue\"></font> time = Time.new time_s = "#{time.year}-#{time.month}-#{time.day} " @wechat.news([{ "title" => "#{time_s} 依赖分析已完成", "description" => "点击进入组件管理平台", "url" => @project_url, "picurl" => @project_cover_image_url }]) # wechat.image('test.png') # # wechat.media(wechat.upload_media('test.csv')['media_id']) # # wechat.file('test.csv') end def result_item_list_string(list, level) result = '' list.each do |name| if level == 'success' result += "\n- <font color=\"#0099ff\">#{name}</font> " else result += "\n- <font color=\"#DC143C\">#{name}</font> " end end result end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yk_command-0.5.0 | lib/yk_command/bot/wx_bot.rb |