Code Monkey home page Code Monkey logo

oasis's Introduction

oasis

Oasis

Bleeding edge object oriented Discordeno framework for creating bots Oasis is minimal by design and it does not ship any cache layer so you can implement your own

Oasis is written Fully in typescript

Efficient & Cross-platform

Oasis is based on Discordeno, a lightweight Discord library for building mostly big Discord bots Since Discordeno is cross platform Oasis ships a Node version by default which is a lot more bleeding-edge! npm install oasis-framework

Creating commands with Deno

Oasis makes it easier to write commands that work on both messages and interactions Oasis avoids the use inheriterance and prefers composition and middlewares

import { Argument, Command, Context } from 'oasis'

// define responses
const responses = [
	'It is certain',
	'It is decidedly so',
	'Without a doubt',
	'Yes, definitely',
	'You may rely on it',
	'Most likely',
	'Outlook good',
	'Yes'
]

@Command
class EightBall {
	readonly data = {
		name: `${responses.length}ball`,
		description: 'Ask the magic 8ball a question'
	}

	readonly aliases = ['ball']

	@Argument('The question', true)
	declare question: string // it works without 'declare' if you compile down to ES2020

	// get all options
	get options(): unknown[] {
		return [this.question] // first argument in the command
	}

	async run(ctx: Context) {
		const question =
			ctx.options.getString(0) ?? ctx.options.getString('question')
		const response = responses[Math.floor(Math.random() * responses.length)]

		if (question) {
			await ctx.respond({
				with: `Question: ${question} | Reply: ${response}`
			})
		}
	}
}

Oasis is minimal by design, so you can make your own Context class that suits your needs.

Installation

Deno: deno cache https://deno.land/x/oasis/mod.ts Node: npm install oasis-framework

Useful resources

TODO's:

  • adding more builders
  • make a CLI

Changelog:

2.0.0

  • Refactor the entire codebase
  • better support for Subcommands
  • Testing
  • 2 new contrib/ files
  • bug fix

1.6.X

  • hotfixes and new contrib file

1.5.X

  • new contrib file
  • bug fixes

1.4.X

  • remove the need for an id when instantiating a bot
  • add the OasisClient class
  • latest bleeding edge version of Discordeno (rc45)

1.3.X

  • remove dead code
  • latest bleeding edge version of Discordeno (rc39)

1.2.X

  • remove the logger plugin

oasis's People

Contributors

yuzudev avatar vyrekxd avatar tricked-dev avatar

Stargazers

Mark Vainomaa avatar Link avatar Fuwn avatar  avatar  avatar  avatar Narcis-Ionuț B. avatar Bae avatar TriForMine avatar Nicolas avatar

Watchers

 avatar

oasis's Issues

[feat] @Command should not require void

Allow @command decorator to return anything. Making it require void, makes code worse. You can not do:

if (!x) return await ctx.respond();

You have to do

if (!x) {
await ctx.respond();
return;
}

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.