All Projects → discordcr → Discordcr

discordcr / Discordcr

Licence: mit
Minimalist Discord library for Crystal. (Still WIP, but usable)

Programming Languages

crystal
512 projects

Projects that are alternatives of or similar to Discordcr

Nino
🔨 Advanced and cute moderation discord bot as an entry of Discord's Hack Week!
Stars: ✭ 78 (-43.07%)
Mutual labels:  discord-api, discord
Music Bot
Simple music bot with a full-blown queue system that is easy to understand
Stars: ✭ 102 (-25.55%)
Mutual labels:  discord-api, discord
Client
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
Stars: ✭ 84 (-38.69%)
Mutual labels:  discord-api, discord
Basicbot
A basic example of a Discord Bot written in Python. (discord.py)
Stars: ✭ 73 (-46.72%)
Mutual labels:  discord-api, discord
Discordpp
A Modularized C++ Library for the Discord API
Stars: ✭ 111 (-18.98%)
Mutual labels:  discord-api, discord
Discordrpcvs
An extension for Visual Studio 2017 that enables Discord Rich Presence.
Stars: ✭ 77 (-43.8%)
Mutual labels:  discord-api, discord
Discord Rich Presence Tool
A C++/Qt program that lets you fill in your own custom Discord Rich Presence information for games and activities away from the PC.
Stars: ✭ 91 (-33.58%)
Mutual labels:  discord-api, discord
Dscord
Discord Library for D
Stars: ✭ 52 (-62.04%)
Mutual labels:  discord-api, discord
Discljord
A Clojure wrapper library for the Discord API, with full API coverage (except voice, for now), and high scalability
Stars: ✭ 111 (-18.98%)
Mutual labels:  discord-api, discord
Serenity
A Rust library for the Discord API.
Stars: ✭ 1,387 (+912.41%)
Mutual labels:  discord-api, discord
Discord.js
discord.js is a powerful Node.js module that allows you to easily interact with the Discord API.
Stars: ✭ 16,432 (+11894.16%)
Mutual labels:  discord-api, discord
Arikawa
A Golang library and framework for the Discord API.
Stars: ✭ 123 (-10.22%)
Mutual labels:  discord-api, discord
Dimscord
A Discord Bot & REST Library for Nim.
Stars: ✭ 67 (-51.09%)
Mutual labels:  discord-api, discord
Bot
A Discord bot for all your needs. With memes, utilities, moderation & more, Fire is the only bot you'll need.
Stars: ✭ 79 (-42.34%)
Mutual labels:  discord-api, discord
Coward
🐔 Coward is a Deno module for easy interaction with the Discord API.
Stars: ✭ 65 (-52.55%)
Mutual labels:  discord-api, discord
Discord.js Menu
💬 Easily create Discord.js v12 embed menus with reactions and unlimited customizable pages.
Stars: ✭ 89 (-35.04%)
Mutual labels:  discord-api, discord
Discord Global Mutual
Get the list of people that you have shared servers with
Stars: ✭ 39 (-71.53%)
Mutual labels:  discord-api, discord
Smorebot
SmoreBot is a fun, lightweight, multipurpose bot packed with features.
Stars: ✭ 51 (-62.77%)
Mutual labels:  discord-api, discord
Swiftdiscord
Discord API Client for Swift
Stars: ✭ 103 (-24.82%)
Mutual labels:  discord-api, discord
Discord Panel
📊 User friendly dashboard/tool for discord bot developpers to manage servers
Stars: ✭ 116 (-15.33%)
Mutual labels:  discord-api, discord

docs

discordcr

(The "cr" stands for "creative name".)

discordcr is a minimalist Discord API library for Crystal, designed to be a complement to discordrb for users who want more control and performance and who care less about ease-of-use.

discordcr isn't designed for beginners to the Discord API - while experience with making bots isn't required, it's certainly recommended. If you feel overwhelmed by the complex documentation, try discordrb first and then check back.

Unlike many other libs which handle a lot of stuff, like caching or resolving, themselves automatically, discordcr requires the user to do such things manually. It also doesn't provide any advanced abstractions for REST calls; the methods perform the HTTP request with the given data but nothing else. This means that the user has full control over them, but also full responsibility. discordcr does not support user accounts; it may work but likely doesn't.

Installation

Add this to your application's shard.yml:

dependencies:
  discordcr:
    github: discordcr/discordcr

Usage

An example bot can be found here. More examples will come in the future.

A short overview of library structure: the Client class includes the REST module, which handles the REST parts of Discord's API; the Client itself handles the gateway, i. e. the interactive parts such as receiving messages. It is possible to use only the REST parts by never calling the #run method on a Client, which is what does the actual gateway connection.

The example linked above has an example of an event (on_message_create) that is called through the gateway, and of a REST call (client.create_message). Other gateway events and REST calls work much in the same way - see the documentation for what specific events and REST calls do.

Caching is done using a separate Cache class that needs to be added into clients manually:

client = Discord::Client.new # ...
cache = Discord::Cache.new(client)
client.cache = cache

Resolution requests for objects can now be done on the cache object instead of directly over REST, this ensures that if an object is needed more than once there will still only be one request to Discord. (There may even be no request at all, if the requested data has already been obtained over the gateway.) An example of how to use the cache once it has been instantiated:

# Get the username of the user with ID 66237334693085184
user = cache.resolve_user(66237334693085184_u64)
user = cache.resolve_user(66237334693085184_u64) # won't do a request to Discord
puts user.username

Apart from this, API documentation is also available, at https://discordcr.github.io/discordcr/doc/v0.4.0/.

Contributing

  1. Fork it (https://github.com/discordcr/discordcr/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

  • meew0 - creator, maintainer
  • RX14 - Crystal expert, maintainer
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].