Coder Social home page Coder Social logo

skyra-project / alestra Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 8.0 3.05 MB

Canvas-Constructor helper bot

License: Apache License 2.0

TypeScript 97.08% Dockerfile 2.92%
canvas-constructor canvas helper discordjs discord-bot sapphire hacktoberfest

alestra's Introduction

Alestra Discord

Alestra has been archived and is no longer maintained. If you're looking for prototyping with canvas-constructor, you can use the button below as well as ask the official server for help.

Edit on Stackblitz

Alestra is a private Discord Bot used for canvas-constructor's official server.

Development Requirements

Set-Up

Copy and paste the .env file and rename it to .env.development.local, then fill it with the precise variables. Once all development requirements are set up:

# Lints and format all the code:
$ yarn lint

# Run Alestra in development mode:
$ yarn start

# Run Alestra in production mode:
$ yarn pm2:start

Note: Before pushing to the repository, please run yarn lint so formatting stays consistent and there are no linter warnings.

Links

Alestra links

Framework links

alestra's People

Contributors

adiologydev avatar bdistin avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar favna avatar ikrishagarwal avatar kyranet avatar leonardssh avatar nm-eea-y avatar stitch07 avatar tech6hutch avatar yorkaargh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

alestra's Issues

[Proposal] Upstream validation on parse

There are many plans for the new parser and we should investigate the fastest path. At this moment, the code is parsed like if it were evaluated with eval(), then it's validated and run. When somebody mistypes a method or does not provide enough arguments (or arguments are invalid type), they are currently detected during validation, this comes as a performance cost because it takes a while to parse all methods in a long chain.

I propose making the parser a generator method and call it from the Evaluator class similarly to this (consider PARSE be the generator method that parses everything):

const canvas = new Canvas(Number(result[1]), Number(result[2]));
let breakChain = null;

for (const [method, args] of PARSE(code)) {
	if (breakChain) {
		throw new MethodParseError(`The CanvasConstructor.prototype.${breakChain} call was not chainable.`);
	}
	if (!(method in Canvas.prototype)) {
		throw new MethodParseError(`The method ${method} does not exist.`);
	}

	if (this.methods.has(method)) {
		if (canvas[method](...await this.methods.get(method).validate(args)) !== canvas) breakChain = method;
	} else {
		throw new MethodParseError(`The method ${method} is blocked.`);
	}
}

That way we can throw during parsing instead of waiting for everything to be parser and then validate.

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.