Discord API
This is a Ruby library for the Discord HTTP API. Currently in development
Installation
Add this line to your application's Gemfile:
gem "discord_api"
Usage
Authentication
Firstly you'll need to set either a user token or bot token. Some endpoints are only accssible with a bot token.
@client = Discord::Client.new(user_access_token: "")
@client = Discord::Client.new(bot_access_token: "")
Users
@client.users.me
@client.users.guilds
Channels
These endpoints are only accessible using a bot token.
@client.channels.retrieve(id: 123123)
@client.channels.update(id: 123123, name: "new-channel-name")
Messages
These endpoints are only accessible using a bot token.
@client.messages.list(channel_id: 123123)
@client.messages.retrieve(channel_id: 123123, message_id: 123123)
@client.messages.create(channel_id: 123123, content: "Hello World")
@client.messages.update(channel_id: 123123, message_id: 123123, content: "Hello World")
@client.messages.delete(channel_id: 123123, message_id: 123123)
@client.messages.bulk_delete(channel_id: 123123, ids: [123123, 321321])
Guilds/Servers
These endpoints are only accessible using a bot token.
@client.guilds.retrieve(id: 123123)
@client.guilds.update(id: 123123, name: "new-guild-name")
@client.guilds.channels(guild: 123123)
@client.guilds.create_channel(guild: 123123, name: "new-channel-name")
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/discord_api.
License
The gem is available as open source under the terms of the MIT License.