Updated user blacklist to a button. Added donation command.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
require 'securerandom'
|
||||
require_relative '../modules/cheese_checker'
|
||||
require_relative '../modules/database'
|
||||
|
||||
@@ -27,21 +28,39 @@ module MessageCheck
|
||||
|
||||
event.message.react("🧀")
|
||||
|
||||
next if Database.server_blacklisted?(event.server.id)
|
||||
next if Database.user_blacklisted?(event.user.id)
|
||||
if Database.server_blacklisted?(event.server.id)
|
||||
puts "[DEBUG] Ignored: Server #{event.server.name} is blacklisted."
|
||||
next
|
||||
end
|
||||
|
||||
if Database.user_blacklisted?(event.user.id)
|
||||
puts "[DEBUG] Ignored: User #{event.user.id} is blacklisted."
|
||||
next
|
||||
end
|
||||
|
||||
begin
|
||||
event.user.pm.send_embed do |embed|
|
||||
embed.title = "Cheese Detected!"
|
||||
embed.description = cheese_content
|
||||
|
||||
embed.color = rand(0xFFFFFF)
|
||||
embed.timestamp = Time.now
|
||||
|
||||
embed.footer = Discordrb::Webhooks::EmbedFooter.new(
|
||||
text: "Use /blacklist to not receive DMs anymore"
|
||||
view = Discordrb::Webhooks::View.new
|
||||
view.row do |r|
|
||||
r.button(
|
||||
label: "Toggle Blacklist",
|
||||
style: :secondary,
|
||||
custom_id: "toggle_cheese_blacklist"
|
||||
)
|
||||
end
|
||||
|
||||
random_color = ("0x" + Random.bytes(3).unpack1('H*')).to_i(16)
|
||||
author = event.user
|
||||
|
||||
embed_generated = {
|
||||
title: "Cheese detected!",
|
||||
description: cheese_content,
|
||||
color: random_color,
|
||||
timestamp: Time.now.iso8601,
|
||||
footer: { text: "Click the button to stop these messages." }
|
||||
}
|
||||
|
||||
# send_message(content, tts, embed, attachments, allowed_mentions, message_reference, components)
|
||||
event.user.pm.send_message(nil, false, [embed_generated], nil, nil, nil, view)
|
||||
rescue Discordrb::Errors::NoPermission
|
||||
puts "Could not DM user #{event.user.username} (#{event.user.id})"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user