Giter Club home page Giter Club logo

cookiecord's Introduction

Cookiecord

Cookiecord simplifies discord bot development by providing a modern and easy to use interface.

Just import Cookiecord and Discord.js and make your commands (and listeners):

example/ping.ts

import { Message } from "discord.js";
import { command, default as CookiecordClient, Module } from "cookiecord";

class PingModule extends Module {
    constructor(client: CookiecordClient) {
        super(client);
    }

    @command()
    ping(msg: Message) {
        msg.reply("Pong. :ping_pong:");
    }
}

new CookiecordClient().registerModule(PingModule).login(process.env.TOKEN);

Features

  • Simple: Cookiecord aims to keep the API very simple and easy to use.
  • Inhibitors: Cookiecord includes a powerful inhibitor system with builtin inhibitors to make restricting commands super easy.
  • Powerful Argument System: Cookiecord automatically validates the user's input based on the types of the arguments your function takes in.
  • Super Fast Development: Cookiecord can automatically reload all of your commands and listeners (using CookiecordClient#reloadModulesFromFolder).

Installation

If you would like to help test Cookiecord you can make a new cookiecord project with the generator:

# With Yarn
$ yarn global add cookiecord-generator
# or with NPM
$ npm install -g cookiecord-generator
# And now to make the project:
$ cookiecord-generator generate my-first-bot

Contribute

Pull requests are always welcome but I would like Cookiecord to remain simple so you should probably ask me about it first.

Support

If you are having issues, please let us know. We have a support chat on Discord.

License

The project is licensed under the LGPL-3 license.

cookiecord's People

Contributors

alii avatar axisiscool avatar boon-cpu avatar ckiee avatar dependabot[bot] avatar exodustx0 avatar jellz avatar robertt avatar samarmeena avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cookiecord's Issues

Parse command arguments surrounded by quote marks as single argument

It'd be very useful if users can call commands with arguments that may contain spaces (or tabs), and have them be considered a single argument. Would love to do you a PR for this!

The way I see it, the way to go is: after getting stringArgs, iterate over it, pushing to an intermediate array, concatenating elements once an element starts with a quote mark until an element ends with a quote mark (or until the last element). I thought about incorporating all conditions into a single regular expression to do the splitting into stringArgs with, but after some experimentatoin I couldn't find a way to do that, but even if I did, it would likely end up very ugly (i.e. not very maintainable).

There is the question of which quote marks should be considered delimiters. Considering that this is for Discord, I'd argue that it makes sense to count backticks and triple-backticks along with the obvious double quotes. Thoughts?

I'd use this list as checklist for implementing this functionality, as it seems general enough.

PS: shouldn't arguments be split on both spaces and tabs?

Help Module field names are not spaced

They are currently using module.constructor.name, which, of course, is not spaced. Something along the lines of:

function splitPascalCase(word: string) {
	return word.match(/($[a-z])|[A-Z][^A-Z]+/g).join(" ");
}

Which will turn "HelpModule" into "Help Module" etc.

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.