Project

discorb

0.02
No release in over a year
== discorb discorb is a Discord API wrapper for Ruby, Using {socketry/async}[https://github.com/socketry/async]. === Contributing Bug reports, feature requests, and pull requests are welcome on {the GitHub repository}[https://github.com/discorb-lib/discorb]. === License This gem is licensed under the MIT License.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.30.1
~> 0.56.5
 Project Readme
discorb
Document Gem Gem Discord GitHub Code Climate maintainability

discorb is a Discord API wrapper for Ruby, Using socketry/async.

Installation

Add this line to your application's Gemfile:

gem 'discorb'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install discorb

Usage

Note You must run discorb setup before using slash commands.

More examples are available in /examples directory.

Simple Slash Command

require "discorb"

client = Discorb::Client.new

client.once :standby do
  puts "Logged in as #{client.user}"
end

client.slash("ping", "Ping!") do |interaction|
  interaction.post("Pong!", ephemeral: true)
end

client.run(ENV["DISCORD_BOT_TOKEN"])

Legacy Message Command

require "discorb"

intents = Discorb::Intents.new
intents.message_content = true

client = Discorb::Client.new(intents: intents)

client.once :standby do
  puts "Logged in as #{client.user}"
end

client.on :message do |message|
  next if message.author.bot?
  next unless message.content == "ping"

  message.channel.post("Pong!")
end

client.run(ENV["DISCORD_BOT_TOKEN"])

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/discorb-lib/discorb.

License

The gem is available as open source under the terms of the MIT License.