23 lines
469 B
Ruby
23 lines
469 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Requests
|
|
class DiscordWebhook
|
|
attr_reader :id, :token
|
|
|
|
def initialize(id:, token:)
|
|
@id = id
|
|
@token = token
|
|
end
|
|
|
|
def client
|
|
Discordrb::Webhooks::Client.new(id: id, token: token)
|
|
end
|
|
|
|
delegate :execute, :edit_message, :delete, to: :client
|
|
|
|
def self.is_deleted(error)
|
|
error.instance_of?(RestClient::NotFound) && JSON.parse(error.response.body)["code"] == 10_015
|
|
end
|
|
end
|
|
end
|