jon/systems/starboard.rb
2024-10-07 15:19:25 +03:00

26 lines
849 B
Ruby

require 'discordrb'
require 'dotenv'
Dotenv.load("#{__dir__}/../.env")
module StarboardSystem
extend Discordrb::EventContainer
reaction_add do |event|
reactions = 0
for reaction in event.message.reactions
if reaction.name == ""
reactions = reaction.count
end
end
attachments = ""
for attachment in event.message.attachments do
attachments += " #{attachment.url}"
end
if reactions == ENV['MINSTARS'].to_i
message = event.message.content.sub!("@", "[at]")
if message == nil
message = event.message.content
end
event.bot.channel(ENV['STARBOARD']).send_message("https://discord.com/channels/#{event.message.channel.server.id}/#{event.message.channel.id}/#{event.message.id} | **#{event.message.author.name} said**: #{message}#{attachments}")
end
end
end