{"id":23084613,"url":"https://github.com/leonardssh/oasis","last_synced_at":"2025-04-03T14:45:41.025Z","repository":{"id":104340896,"uuid":"500628640","full_name":"leonardssh/oasis","owner":"leonardssh","description":"An object oriented Discordeno framework","archived":false,"fork":false,"pushed_at":"2022-06-01T22:39:53.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T02:49:28.294Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"oasisjs/oasis","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonardssh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-06T23:54:18.000Z","updated_at":"2022-06-06T23:52:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"abe6112e-4378-4d1d-a680-3df56bec57ca","html_url":"https://github.com/leonardssh/oasis","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardssh%2Foasis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardssh%2Foasis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardssh%2Foasis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonardssh%2Foasis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonardssh","download_url":"https://codeload.github.com/leonardssh/oasis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247024116,"owners_count":20870935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-16T16:12:59.205Z","updated_at":"2025-04-03T14:45:41.018Z","avatar_url":"https://github.com/leonardssh.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Oasis\n\nBleeding edge object oriented Discordeno framework for creating bots Oasis is minimal by design and it does not ship any\ncache layer so you can implement your own\n\u003e Oasis is written Fully in typescript\n\n## Efficient \u0026 Cross-platform\n\nOasis is based on Discordeno, a lightweight Discord library for building mostly big Discord bots Since Discordeno is\ncross platform Oasis ships a Node version by default which is a lot more bleeding-edge! `npm install oasis-framework`\n\n## Creating commands with Deno\n\nOasis makes it easier to write commands that work on both messages and interactions Oasis avoids the use inheriterance\nand prefers composition and middlewares\n\n```ts\nimport { Argument, Command, Context } from 'oasis';\n\n// define responses\nconst responses = [\n    'It is certain',\n    'It is decidedly so',\n    'Without a doubt',\n    'Yes, definitely',\n    'You may rely on it',\n    'Most likely',\n    'Outlook good',\n    'Yes',\n];\n\n@Command\nclass EightBall {\n    readonly data = {\n        name: `${responses.length}ball`,\n        description: 'Ask the magic 8ball a question',\n    };\n\n    readonly aliases = ['ball'];\n\n    @Argument('The question', true)\n    declare question: string; // it works without 'declare' if you compile down to ES2020\n\n    // get all options\n    get options(): unknown[] {\n        return [this.question]; // first argument in the command\n    }\n\n    async run(ctx: Context) {\n        const question = ctx.options.getString(0) ?? ctx.options.getString('question');\n        const response = responses[Math.floor(Math.random() * responses.length)];\n\n        if (question) {\n            await ctx.respond({ with: `Question: ${question} | Reply: ${response}` });\n        }\n    }\n}\n```\n\n## How make a simple middleware to execute commands\n\nOasis is minimal by design, so you can make your own Context class that suits your needs heres a minimal example of how\nto write a middleware (no typescript needed)\n\n```ts\nconst PREFIX = '-\u003e';\nconst { interactionCreate, messageCreate } = bot.events;\n\nbot.events.interactionCreate = (bot, interaction) =\u003e {\n    if (interaction.user.toggles.bot) {\n        interactionCreate(bot, interaction);\n        return;\n    }\n\n    const ctx = new Context(PREFIX, bot, undefined, interaction);\n    const commandName = ctx.getCommandName();\n\n    if (!commandName) {\n        return;\n    }\n\n    const [command] = commands.get(commandName) ?? [];\n\n    if (command) {\n        command.run(ctx);\n    }\n\n    interactionCreate(bot, interaction);\n};\n\nbot.events.messageCreate = (bot, message) =\u003e {\n    if (message.isBot) {\n        // forward the event\n        messageCreate(bot, message);\n        return;\n    }\n\n    // make sure to import Context from oasis\n    const ctx = new Context(PREFIX, bot, message, undefined);\n    const commandName = ctx.getCommandName();\n\n    if (!commandName) {\n        return;\n    }\n\n    const [command] = commands.get(commandName) ?? commands.get(commandAliases.get(commandName) ?? '') ?? [];\n\n    if (command) {\n        command.run(ctx);\n    }\n\n    messageCreate(bot, message);\n};\n```\n\n## Installation\n\nDeno: `deno cache https://deno.land/x/oasis/mod.ts` Node: `npm install oasis-framework`\n\n## Useful resources\n\n- the [Discordeno](https://github.com/discordeno/discordeno) library and [website](https://discordeno.mod.land/)\n- the Discordeno [Discord server](https://discord.gg/ddeno) so you can ask me for help\n- Cache layer for Discordeno https://github.com/discordeno/discordeno/blob/main/plugins/cache\n- Bot using the Oasis framework (not released yet) https://github.com/yuzudev/akebi\n\n### TODO's:\n\n- adding more builders\n- make a CLI\n\n### Changelog:\n\n#### 1.4.X\n- remove the need for an id when instantiating a bot\n- add the OasisClient class\n- latest bleeding edge version of Discordeno (rc45)\n\n#### 1.3.X\n- remove dead code\n- latest bleeding edge version of Discordeno (rc39)\n\n#### 1.2.X\n- remove the logger plugin","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonardssh%2Foasis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonardssh%2Foasis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonardssh%2Foasis/lists"}