~komidore64/lib_discord

Unfancy Discord API Ruby-bindings

121a71e chore: bundle update

4 days ago

7bffc21 chore: bump version to 0.1.2

4 days ago

#lib_discord

Unfancy Ruby-bindings to interact with Discord's HTTPS/REST 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 the 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 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["application"]
# => #<LibDiscord::Application: ... >

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
# => JSON body deserialized to a Hash

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

#Getting help

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

#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, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

#Code style

This project adheres to Standard Ruby style rules.

Additionally, we strive for an 80 character line length, but it's not a hard-and-fast rule. There are occasions where breaking an expression across multiple lines decreases readability for no benefit other than to appease a linter. As such, there is no tool to enforce it.

#Code of Conduct

Everyone interacting in the lib_discord project's codebase, bug trackers, chat rooms, and mailing lists is expected to follow the code of conduct.

#Licenses

See files in the LICENSES directory.