Giter Club home page Giter Club logo

corde's Introduction

                        _       
                       | |      
  ___   ___   _ __   __| |  ___ 
 / __| / _ \ | '__| / _` | / _ \
| (__ | (_) || |   | (_| ||  __/
 \___| \___/ |_|    \__,_| \___|
                                

report card badge


corde is a discord webhook callback API wrapper. It aims to have an high level API to simplify the user's life as much as possible.

It contains many functions to help write as clean and concise code as possible, such as f suffixed functions which act like Sprintf.

It also has builders of some kinds, such as embed and response builders, which make error handling and responding a breeze.

All those don't hinder the fact that you can use corde with as much control as you want.

Be aware that breaking changes will happen as of now, at least until v1.

Install

go get github.com/Karitham/corde

Usage

The easiest way to run the examples, or even to run your own is to use ngrok no login or domain required, and the product itself is great.

Examples

The most basic one is bongo

Then comes todo that shows off subcommands routing and options

And then we have moderate-myself which is able to show and delete currently available commands. It demonstrates the usage of components such as buttons.

Finally, we have nft which is a simple example using user commands & message commands.

Corde is also actively used to rewrite and develop another discord bot of mine called WaifuBot (for now see the corde branch)

Why

Having used most go discord libs available, I wanted something very lightweight yet high-level, that could just run on a lambda without state, caching or long start-up times.

Corde has a single runtime dependency as of yet, a radix tree for routing purposes (and it's epic, you should check it out).

The common libs out there didn't really fit that purpose, and neither did they implement the webhook callback API available.

Corde means rope in french, because discord's API inspires exactly that /s

corde's People

Contributors

jolheiser avatar karitham avatar smantic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

corde's Issues

Builders

Builders are currently a mess, and you even have to call B() at the end to build the embed/response.

We should be able to make corde's embed/responses actual builders themselves, and we wouldn't have to rely on yet another type.

Testing

Currently, there's very little tested on the main functionality.

With #7 landing, we should be able to make basic integration tests extremely easily, and as such, try to cover more of our API

Types & Mapping

We need to make sure all the API types are correctly fleshed out, with the correct struct tags & pointers, as to meet discord's API definitions.

owmock's types are basically there, but they're not exactly implemented in the library.

We also need to map the rest of the API, but this is a long and boring task, which can be done on the go

format accept snowflake

Currently most format's signatures accept strings, however, when formatting a user object for example, we are most likely to be using a snowflake.

I think we should change those signatures.

As an example, there is

s.WriteString(fmt.Sprintf("%d. %s: %s - %s\n", i, k, v.value, format.User(v.user.String())))

Which would benefit from just taking in a Snowflake.

We could also take in any, and check for string, fmt.Stringer or use fmt.Sprint, but I'm not exactly sure how that'd end up looking

Middlewares

Middlewares are lovely.

They're useful for all kinds of stuff, and they're especially useful when accompanied by a great routing library.

We need to figure out a nice design to apply middlewares to Routes, Groups and Subroutes. Chi does this amazingly well

Menus support

Along with slash commands, there's menu abilities, but they aren't tested. (No idea how they work yet either)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.