# @overload post(data)
# Post data to the default DISCORD_WEBHOOK_URI
# @param data [Hash] the webhook data
# @overload post(url, data)
# Post data to a Discord Webhook using an URL or an URI
# @param url [URI, String] the Discord Webhook
# @param data [Hash] the webhook data
# @param key [String] the key in DISCORD_WEBHOOK_URI
def post(url, data = url, key = :default)
url = DISCORD_WEBHOOK_URI[key] if url.is_a?(Hash)
url = URI(url) if url.is_a?(String)
begin
Net::HTTP.post(url, data.to_json, "Content-Type" => "application/json")
rescue Exception
end
p "ok"
end
def test()
Thread.new do
post(
username: 'Pokemon Prisme',
content: "Test",
embeds: [
{
"description": "Test"
}
]
)
end
p "done"
end