Code Monkey home page Code Monkey logo

yor.ts's Introduction

Yor.ts

Yor.ts

A highly performant and typed library to make discord http based bots

GitHub License npm Discord

Features

  • Performance: Designed to be highly efficient and performant, reducing the load on your server.
  • Type Safety: Fully typed with TypeScript, providing better developer experience and catching errors at compile time.
  • HTTP Based: Bypasses the traditional websocket connection, providing more stability and scalability.
  • Easy to Use: Clear and comprehensive documentation, allowing developers of all experience levels to get started easily.
  • Modular Design: The library is designed to be modular, letting you pick and choose the components you need for your bot.
  • Cloudflare Workers Support: Capable of running on Cloudflare Workers, providing you with more hosting options.
  • Interaction Support: Full support for Discord's new interaction features, including buttons and select menus.

Getting Started

Install Yor.ts using npm/yarn/pnpm/bun:

npm i yor.ts
yarn add yor.ts
pnpm add yor.ts
bun add yor.ts

Note

Depending on where you're hosting your bot and what kind of provider you're using, you might need to polyfill some of the node libs to make it work. For example on cloudflare workers you will need to polyfill node:util and node:url in order to work. When you come across something like this, use esbuild and esbuild-node-polyfill to polyfill it.

Contributing

See contributing guide

Issues

See issues

Pull Requests

See pull requests

Support

Join our discord server: Discord

Documentation

See documentation guide

Changelog

See changelog

License

MIT

Special Thanks

  • discordjs for creating beautiful packages like rest/core

Maintainers

yor.ts's People

Contributors

deepsource-autofix[bot] avatar orekiie avatar

Stargazers

 avatar

Watchers

 avatar

yor.ts's Issues

Incorrectly typed constant to get subcommand options

Upon using any CommandContext's method to get subcommand options, for example:

const string = ctx.getStringOption("string");
ctx.reply({ content: string });

This currently returns a DiscordAPIError: Cannot send an empty message.

I believe the issue lies on line 232 of src/Contexts/CommandContext:

const options = this.raw.data.options;

This returns an Array which contains the actual expected options[] of this method, causing the output to be null:

// Structure of this.raw.data.options
options: [{ name, options: [], type }]
// Expected structure
options: [{ name, value, type }]
// This is currently finding the subcommand
option = options.find((option) => option.name === name);

I temporarily patched the issue by editing that line:

const options = this.raw.data.options[0].options;

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.