open-index/open-npm huggingface dataset:
npm package: @reinforz/cordmand
Description: A utility package for making discord-bot commands much easier to write with discord.js
Author: imoxto
Latest version: 0.0.4

# Cordmand

## About
A utility package for making discord-bot commands much easier to write with discord.js.

## Usage Example

#### Install this package:
```bash
npm i @reinforz/cordmand
```
or,
```bash
yarn add @reinforz/cordmand
```

#### Example typescript file:
```ts
import { Client, GatewayIntentBits } from "discord.js";
import { addCommands } from "@reinforz/cordmand";
import { Commands } from "@reinforz/cordmand/types";

// initiate discord.js client
const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildMembers,
  ],
});

// define your commands similar to
const commands: Commands = {
  interactionCreate: [
    // define interactions here
    {
      name: "ping",
      cb: async (interaction) => {
        await interaction.reply("Pong!");
      },
    },
    {
      name: "hello",
      message: {
        content: "hello",
        ephemeral: true,
      },
    },
  ],

  messageCreate: [
    {
      regex: /ping/i,
      message: "pong",
    },
    {
      regex: /hi/i,
      // message can also be a callback function which can access the discord message object
      message: (_, message) => `hello <@${message.author.id}>`,
    },
    {
      regex: /bye/i,
      message: (_, message) => `bye ${message.author.username}`,
      reply: true, // uses discord's message.reply intead of just sending the message in the same channel
    },
    {
      regex: /args/i,
      message: (args) => `The arguments are: ${args.join(", ")}`,
      reply: true, 
    },
  ],
};

// add commands to the client by calling the addCommands function provided by the client
addCommands(client, commands, {
  messageCommandPrefix: /^i!/i,
  // Add your command prefix regex. Make sure to include ^ (starts with) in the regex
});

// login
client.login(process.env.BOT_TOKEN!);
```

#### Example with just using `makeDiscordClient` function:
```ts
import { makeDiscordClient } from "@reinforz/cordmand";
import { Commands, MakeDiscordClientOptions } from "@reinforz/cordmand/types";
import { commands } from "./some-file"

const makeClientOptions: MakeDiscordClientOptions = {
  botToken: process.env.BOT_TOKEN!,
  clientOptions: {
    intents: ["Guilds", "GuildMessages", "MessageContent", "GuildMembers"],
  },
  commands, // the same command object as previous one, It will work in the same way as the previous example
  addCommandsOptions: {
    messageCommandPrefix: /^i!/i,
  },
};

makeDiscordClient(makeClientOptions);
```

## Contributors

- [imoxto](https://github.com/imoxto)
npm package: @reinis_frp/snapshot.js
Description: [![npm](https://img.shields.io/npm/v/@snapshot-labs/snapshot.js?label=npm)](https://www.npmjs.com/package/@snapshot-labs/snapshot.js)
Latest version: 0.10.1

# Snapshot.js

[![npm](https://img.shields.io/npm/v/@snapshot-labs/snapshot.js?label=npm)](https://www.npmjs.com/package/@snapshot-labs/snapshot.js)

## Install

Snapshot.js was designed to work both in the browser and in Node.js.

### In Node Applications

To install Snapshot.js on Node.js, open your terminal and run:

```bash
npm i @snapshot-labs/snapshot.js
```

#### Browser

You can create an index.html file and include Snapshot.js with:

```html
<script src="https://cdn.jsdelivr.net/npm/@snapshot-labs/snapshot.js"></script>
```

### Development

#### Install dependencies

```bash
yarn
```

#### Build package

```bash
yarn build
```

#### Test cases

```bash
yarn test
# or
yarn test:once
```

#### Other useful scripts

```bash
# Format ABI
ts-node scripts/abi.ts
# Generate hash for types
ts-node scripts/generateHashWithTypes.ts
```

### License

[MIT](LICENSE).
npm package: @reinjs/rein
Description: rein framework
Author: reinjs
Latest version: 1.0.19

# rein

The main framework of reinjs

## Install

```shell
npm i @reinjs/rein
```

## Usage

Use in common project:

```javascript
const Worker = require('@reinjs/rein');
const worker = new Worker({
  cwd: __dirname
});
worker.listen();
```

Use in cluster:

```javascript
const Cluster = require('@reinjs/rein-cluster');
const cluster = new Cluster({
  cwd: __dirname,
  agents: ['book'],
  timeout: 10000,
  framework: '@reinjs/rein'
});
cluster.listen().then(() => console.log('cluster is ok')).catch(e => console.error(e));
```

More API see document(coming soon...).

# License

It is [MIT licensed](https://opensource.org/licenses/MIT).
npm package: @reinjs/rein-cli
Description: The cluster module of reinjs
Author: reinjs
Latest version: 1.0.8

# @reinjs/rein-cli

The cli for rein

## Install

```shell
npm i @reinjs/rein-cli -g
```

## Commander

- `app :name([a-z0-9_\-]+)?`  创建新项目

# License

It is [MIT licensed](https://opensource.org/licenses/MIT).
npm package: @reinjs/rein-cluster
Description: The cluster module of reinjs
Author: reinjs
Latest version: 1.0.5

# rein-cluster

The cluster module of reinjs

## Install

```shell
npm i @reinjs/rein-cluster
```

## Options

| property | type | description | default |
| :---- | :---- | :---- | :---- |
| cwd | `string` | project root path | `process.cwd()` |
| agents | `array<string> or undefined` | agents list | undefined |
| maxWorkers | `number` | worker counts | `os.cpus().length` |
| timeout | `number` | timeout | Infinity |
| framework | `string` | framework name or dir path | undefined |

## Usage

```javascript
const Cluster = require('@reinjs/rein-cluster');

const cluster = new Cluster({
  cwd: __dirname,
  agents: ['a', 'b', 'c', 'e'],
  timeout: 10000,
  framework: '@reinjs/rein'
});

cluster.listen();
// Use Promise like this:
// cluster.listen().then(() => console.log('cluster ok')).catch(e => console.error(e));
```

## Framework

We provide three invoking lifecycle to build framework, also it must return a class.

- @life message(msg): <Promise> 消息通知生命周期
- @life create(): <Promise> 启动服务生命周期
- @life destroy(signal): <Promise> 销毁服务生命周期

It is easily to build framework by three lifecycle.

```javascript
const Koa = require('koa');
module.exports = class Worker extends Koa {
  constructor(obj) {
    super();
    this.app = obj;
    this.logger = console;
  }

  async create() {
    await new Promise((resolve, reject) => {
      this.use(async ctx => ctx.body = 'Hello world');
      this.listen(8080, err => {
        if (err) return reject(err);
        this.logger.log('server on `http://127.0.0.1:8080`');
        resolve();
      });
    });
  }

  async message(msg) {
    console.log(this.app.pid, 'in message lifecycle')
  }

  async destroy(signal) {
    console.log(this.app.pid, 'in destroy lifecycle', signal)
  }
};
```

# License

It is [MIT licensed](https://opensource.org/licenses/MIT).
npm package: @reinjs/rein-command
Description: The commander library of rein-cli
Author: reinjs
Latest version: 1.0.12

# @reinjs/rein-command

The commander library of rein-cli

## Install

```shell
npm i @reinjs/rein-command
```

## Usage

```javascript
const program = require('@reinjs/rein-command');
const app = new program(__dirname);
app.version(pkg.version);
app.plugin({ ... });
app.use('npm owner', '../lib/middleware/auth2');
app.param('name', '../lib/middleware/param');
app.command('npm owner add :name([a-zA-z0-9]+)', '../lib/middleware/auth', '../lib/owner.add');
app.listen();
```

Then we use command `npm owner add evio`

# License

It is [MIT licensed](https://opensource.org/licenses/MIT).