# webhook-bot-js

> A JavaScript library for creating Webhook-Based Discord Bots

Latest version **0.1.6** (published 2022-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install webhook-bot-js
pnpm add webhook-bot-js
yarn add webhook-bot-js
bun add webhook-bot-js
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2022-06-23 |
| First published | 2022-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 5 |
| Unpacked size | 122.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Duckulus |
| Maintainers | duckulus |
| Keywords | discord, discord api, discord.js, webhook, webhook-bot, http, http-bot, interactions, http-interactions, commands, slashcommands |

## Links

- npm: https://www.npmjs.com/package/webhook-bot-js
- Repository: https://github.com/Duckulus/webhook-bot-js
- Homepage: https://github.com/Duckulus/webhook-bot-js#readme
- Issues: https://github.com/Duckulus/webhook-bot-js/issues
- npm.io page: https://npm.io/package/webhook-bot-js

## Dependencies (5)

- [tslog](https://npm.io/package/tslog.md) ^3.3.3
- [express](https://npm.io/package/express.md) ^4.18.1
- [tweetnacl](https://npm.io/package/tweetnacl.md) ^1.0.3
- [@discordjs/rest](https://npm.io/package/@discordjs/rest.md) ^0.5.0
- [discord-api-types](https://npm.io/package/discord-api-types.md) ^0.33.1

## Recent versions

- 0.1.6 (latest) — 2022-06-23
- 0.1.5 — 2022-06-23
- 0.1.4 — 2022-06-22
- 0.1.3 — 2022-06-22
- 0.1.2 — 2022-06-22
- 0.1.1 — 2022-06-22
- 0.1.0 — 2022-06-22

## README

## `webhook-bot-js`

A JavaScript library for creating Webhook-Based Discord Bots

### Installation:

`npm install webhook-bot-js`\
or\
`yarn add webhook-bot-js`

### Example:
````js
import { WebhookServer, CommandOption, getStringOption, CommandResponse } from "webhook-bot-js";

//create server by providing information about your application
const server = new WebhookServer({
    application_id: "APPLICATION_ID",
    token: "BOT_TOKEN",
    public_key: "APPLICATION_PUBLIC_KEY",
});

//register a slash command
server.registerSlashCommand({
    name: "hello",
    description: "Greet someone",
    options: [
        {
            name: "name",
            description: "The name of the person to greet",
            type: CommandOption.STRING,
            required: true,
        },
    ],
    execute: (interaction) => {
        const name = getStringOption(interaction, "name");
        return {
            type: CommandResponse.Message,
            data: {
                content: `Hello ${name}`,
            },
        };
    },
});

//register commands against discords api
server.pushGlobalApplicationCommands();

//start server
server.start();
````
More examples can be found in the [examples](examples) directory

---
_Source: https://npm.io/package/webhook-bot-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
