2024-10-06 14:12:09 +03:00
|
|
|
require 'discordrb'
|
|
|
|
require 'dotenv'
|
|
|
|
Dotenv.load("#{__dir__}/../.env")
|
|
|
|
|
|
|
|
module StarboardSystem
|
|
|
|
extend Discordrb::EventContainer
|
|
|
|
reaction_add do |event|
|
|
|
|
reactions = 0
|
2024-10-06 17:51:17 +03:00
|
|
|
for reaction in event.message.reactions
|
2024-10-06 14:12:09 +03:00
|
|
|
if reaction.name == "⭐"
|
2024-10-06 17:51:17 +03:00
|
|
|
reactions = reaction.count
|
2024-10-06 14:12:09 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
attachments = ""
|
|
|
|
for attachment in event.message.attachments do
|
|
|
|
attachments += " #{attachment.url}"
|
|
|
|
end
|
2024-10-07 15:19:25 +03:00
|
|
|
if reactions == ENV['MINSTARS'].to_i
|
2024-10-06 14:12:09 +03:00
|
|
|
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
|