Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oncordjs/generate

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oncordjs/generate

@oncord/client project generator.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
increased by350%
Maintainers
0
Weekly downloads
 
Created
Source

Create Oncord App

A CLI tool to generate new projects using @oncordjs/client, inspired by create-next-app.

Installation

You can install the CLI globally using npm:

npm install -g @oncordjs/generate

Usage

To create a new Oncord project, run:

create-oncord-app <project-name>

Replace <project-name> with the name of your new project. This will create a directory with the specified name, containing a basic project structure using @oncordjs/client.

Example

create-oncord-app my-new-oncord-project

This will generate the following structure:

my-new-oncord-project/
├── package.json
├── tsconfig.json
├── src/
│   ├── index.ts
│   └── commands/
│       └── util/
│           └── ping.ts
└── ...

Options

You can pass additional options to customize your project:

create-oncord-app <project-name> [options]

For example, you can specify a template:

create-oncord-app my-new-oncord-project --template typescript

Project Structure

The recommended project structure for Oncord is as follows:

my-bot/
├── src/
│   ├── index.ts
│   ├── commands/
│   │   └── util/
│   │       └── ping.ts
├── tsconfig.json
└── package.json

Example Usage

JavaScript Example

my-bot/src/index.js

const { Gateway } = require('@oncordjs/client')

const client = new Gateway("YOUR_BOT_TOKEN", {
    intents: ['Guilds']
});

client.handleCommands(__dirname + "/commands", ".js");

client.login();

Command Example

module.exports = {
    data: {
        name: "ping",
        description: 'Replies with Pong!'
    },
    execute: async (interaction) => {
        interaction.reply("Pong!");
    }
}

TypeScript Example

my-bot/src/index.ts

import { Gateway } from '@oncordjs/client';

const client = new Gateway("YOUR_BOT_TOKEN", {
    intents: ['Guilds']
});

client.handleCommands(__dirname + "/commands", ".ts"); // <Gateway>.handleCommands(folderPath, fileExtension);

client.login();

Command Example

my-bot/src/commands/util/ping.ts

import { CommandType } from '@oncordjs/client';
import { CommandInteraction } from 'discord.js';

const command: CommandType = {
    data: {
        name: 'ping',
        description: 'Replies with Pong!'
    },
    execute: async (interaction: CommandInteraction) => {
        await interaction.reply('Pong!');
    }
};

export default command;

Development

To work on the CLI tool itself, follow these steps:

  1. Clone the repository:
    git clone https://github.com/yourusername/create-oncord-app.git
    
  2. Navigate to the project directory:
    cd create-oncord-app
    
  3. Install dependencies:
    npm install
    
  4. Build the project:
    npm run build
    
  5. Link the package locally for testing:
    npm link
    

You can now use create-oncord-app locally.

Contributing

Contributions are welcome! If you have any questions or want to contribute, you can find the project on GitHub. Feel free to open issues or submit pull requests.

  • GitHub Repository

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Thank you for using OnCord!

This README.md now includes the detailed Oncord documentation, providing clear instructions and examples for setting up a project using @oncordjs/client. Adjust the content as needed to fit your specific project.

FAQs

Package last updated on 14 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc