termtter /lib/plugins/gsub.rb

Language Ruby Lines 18
MD5 Hash 765db80c041c1ff9122aef0bb0435b1f
Repository https://github.com/Epictetus/termtter.git View Raw File
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# -*- coding: utf-8 -*-

config.plugins.gsub.set_default(:table, [
  [/([★☆△▽…□♪♬])(?=\S)/, '\1 '],
  [/(?=\S)(https?:\/\/)/, ' \1'],
])

Termtter::Client.register_hook(
  :name => :gsub,
  :point => :filter_for_output,
  :exec => lambda {|statuses, event|
    statuses.each do |s|
      t = s.text
      config.plugins.gsub.table.each {|a, b| t.gsub!(a, b || '') }
    end
  }
)
Back to Top