~komidore64/lib_discord

Unfancy Discord API Ruby-bindings

#3 Remove external dependency on http

~komidore64 commented on lib_discord todo

5 days ago

b0c69ff chore: we don't need to save coverage

30 days ago

#lib_discord

Unfancy Ruby-bindings to interact with Discord's HTTPS web API.

project -- sources -- mailing lists -- bug tracker

builds.sr.ht status Gem Version

#Installation

lib_discord requires an installed Ruby runtime >= 3.2.

Install the gem and add to your application's Gemfile by executing:

bundle add lib_discord

If bundler is not being used to manage dependencies, install the gem by executing:

gem install lib_discord

#Usage

require "lib_discord"
client = LibDiscord::Client.new("Bot my.amazing.bot.token")

Access different resource types with #[] syntax:

client.keys
# =>
# ["application",
#  "application_command",
#  "application_role_connection_metadata",
#  "audit_log",
#  "auto_moderation",
#  "channel",
#  "emoji",
#  "guild",
#  "guild_scheduled_event",
#  "guild_template",
#  "interaction",
#  "invite",
#  "poll",
#  "stage_instance",
#  "sticker",
#  "user",
#  "voice",
#  "webhook"]

client["channel"]
# => #<LibDiscord::Channel: ... >

Use resources to make requests to Discord's API. LibDiscord resources are mapped to the "Resources" described in Discord's developer documentation.

resp = client["guild"].get_guild_channels(guild_id: "12345678901234567890")

resp.code
# => 200

resp.headers
# => Hash of HTTP response headers

resp.body_parsed
# => deserialized JSON body

resp.body_raw
# => raw response body in String form

#Getting help

Please use the mailing lists if you have questions or need assistance.

#Contributing

Bug reports and patch submissions are welcome on SourceHut via the bug tracker and mailing lists, respectively. This project is intended to be a safe and welcoming space for collaboration. All participants are expected to adhere to the code of conduct.

See CONTRIBUTING.md for more details.

#Licenses

See files in the LICENSES/ directory.