-
-
Save shibafu528/6efde6ae8d9ec3bcc993826b8648e51f 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
# -*- coding: utf-8 -*- | |
require 'set' | |
Plugin.create(:extract_manko) do | |
replied = Set.new | |
subscribe(:extract_receive_message, :"mastodon-shibafud@ertona.net-home").each do |message| | |
uri = message.uri.to_s | |
if message.created > defined_time && !message.user.me? && !message.reblog? && !replied.include?(uri) && | |
message.description =~ /(manko|まんこ|マンコ)/ | |
notice "Incoming #{message.uri.inspect}: #{message.inspect}" | |
replied << uri | |
notice "replied.size => #{replied.size}" | |
world, = Plugin.filtering(:world_current, nil) | |
compose(world, message, body: "@#{message.user.idname} お :manko: ぉ^〜 #bot", visibility: :unlisted).next do |msg| | |
notice "Reply success: #{msg.inspect}" | |
end.trap do |err| | |
error "Reply failed: #{err.inspect}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment