Skip to content

Instantly share code, notes, and snippets.

@shibafu528
Last active May 1, 2021 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shibafu528/6efde6ae8d9ec3bcc993826b8648e51f to your computer and use it in GitHub Desktop.
Save shibafu528/6efde6ae8d9ec3bcc993826b8648e51f to your computer and use it in GitHub Desktop.
再発防止策
# -*- 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