Files
FrugalityBot/src/commands/testing/embed.rb

45 lines
1.8 KiB
Ruby

# FrugalityBot
# Copyright (C) 2026 Eri (csxkdv/nxkdv) nxkdv@thenight.club
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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'
module Commands
module Embed
extend self
def register(bot, _db)
bot.register_application_command(:embed, 'This is an embed testing', server_id: ENV['TEST_SERVER_ID']) do |cmd|
end
bot.application_command(:embed) do |event|
color_generated = ("0x" + Random.bytes(3).unpack1('H*')).to_i(16)
embed_generated = {
title: "Title testing.",
description: "Description testing.",
color: color_generated,
fields: [
{ name: "Field 1", value: "Value for field 1", inline: true },
{ name: "Field 2", value: "Value for field 2", inline: false }
],
image: { url: "https://i.kym-cdn.com/photos/images/original/002/349/700/e38.jpg" },
footer: { text: "Footer testing." }
}
event.respond(embeds: [embed_generated])
end
end
end
end