Created
January 5, 2013 00:18
-
-
Save mattbailey/4458738 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'RMagick' | |
$flood = 0 | |
def weechat_init | |
Weechat.register("ymf", "ribo", "1.0", "GPL3", "YAO MING FACE", "", "") | |
Weechat.hook_print "", "", ".ymf", 1, "ymf", "" | |
return Weechat::WEECHAT_RC_OK | |
end | |
def ymf(data,buffer,time,tags,displayed,highlight,prefix,message) | |
filename = "#{(0...8).map{65.+(rand(26)).chr}.join.downcase}.jpg" | |
url = "https://mdb.io/ymf/#{filename}" | |
image = Magick::Image.read('/var/www/ymf.jpg').first | |
captioned = Magick::Draw.new | |
string = message.gsub('.ymf ', '') | |
captioned.annotate(image, 0,0,0,0, string) { | |
self.font = '/var/www/ymf/Impact.ttf' | |
self.pointsize = 68 | |
self.gravity = Magick::NorthGravity | |
self.stroke = 'white' | |
self.stroke_width = 2 | |
self.fill = 'black' | |
} | |
image.write("/var/www/ymf/#{filename}") | |
Weechat.command(buffer, url) | |
return Weechat::WEECHAT_RC_OK | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment