add starboard
This commit is contained in:
parent
1d33f6d468
commit
6da8b6bf10
@ -4,3 +4,6 @@ PREFIX=;
|
||||
ADMIN=
|
||||
BOT_ID=
|
||||
FORBIDDEN_WORDS=word1,word2
|
||||
|
||||
STARBOARD=
|
||||
MINSTARS=3
|
1
bot.rb
1
bot.rb
@ -30,4 +30,5 @@ systems.each { |i| require_relative "#{i}" }
|
||||
bot.include! QuoteSystem
|
||||
bot.include! NetworkModule
|
||||
bot.include! TriggerSystem
|
||||
bot.include! StarboardSystem
|
||||
bot.run
|
||||
|
26
systems/starboard.rb
Normal file
26
systems/starboard.rb
Normal file
@ -0,0 +1,26 @@
|
||||
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 do
|
||||
if reaction.name == "⭐"
|
||||
reactions = reactions + 1
|
||||
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
|
Loading…
Reference in New Issue
Block a user