# core-discord

> ### TS-Use only. ## Initialising Client & Start ``` import { Client } from "core-discord";

Latest version **2.0.5** (published 2022-03-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install core-discord
pnpm add core-discord
yarn add core-discord
bun add core-discord
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.5 |
| Published | 2022-03-25 |
| First published | 2022-03-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 18.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ivan |
| Maintainers | tehivan |

## Links

- npm: https://www.npmjs.com/package/core-discord
- Repository: https://github.com/TehIvan/discord-core
- Homepage: https://github.com/TehIvan/discord-core#readme
- Issues: https://github.com/TehIvan/discord-core/issues
- npm.io page: https://npm.io/package/core-discord

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^7.2.0
- [consola](https://npm.io/package/consola.md) ^2.15.3
- [discord.js](https://npm.io/package/discord.js.md) ^13.6.0
- [@types/glob](https://npm.io/package/@types/glob.md) ^7.2.0

## Recent versions

- 2.0.5 (latest) — 2022-03-25
- 2.0.4 — 2022-03-25
- 2.0.3 — 2022-03-21
- 2.0.2 — 2022-03-21
- 2.0.1 — 2022-03-21
- 2.0.0 — 2022-03-20
- 1.0.6 — 2022-03-20
- 1.0.5 — 2022-03-20
- 1.0.3 — 2022-03-05
- 1.0.2 — 2022-03-05
- 1.0.1 — 2022-03-05
- 1.0.0 — 2022-03-01

## README

# Discord Core Documentation

### TS-Use only.
## Initialising Client & Start
```
import { Client } from "core-discord";

const client = new Client({
    token: "YOUR_TOKEN",
    prefix: "PREFIX",
    intents: [],
    partials?: [],
    paths: {
        commands: "./commands",
        events: "./events"
    },
    color: "RED",
    footer: {text: "", iconURL?: ""}
});

client.start();
```

## Registering Events
#### Create a new file under the events path
```
import { Client, Event } from "core-discord"

export default class Ready extends Event {
    constructor() {
        super("ready");
    }

    public run(client: Client) {
        client.logger.info(`Logged in as ${client.user.tag}!`);
    }
}
```

## Registering Commands
#### Create a new file under the commands path
```
import { TextChannel, GuildMember, Message } from "discord.js";
import { Client, Command } from "core-discord";

export default class Ping extends Command {
    constructor() {
        super("ping", "Pong!", "ping", ["GUILDS"], ["ROLEIDS"], true);
    }

    async run(client: Client, channel: TextChannel, member: GuildMember, message: Message<boolean>, args: string[]): Promise<void> {
        const ping = Date.now() - message.createdTimestamp;
        channel.send({
            embeds: [client.util.generateEmbed({
                title: "Pong!",
                description: `${ping}ms`,
            })]
        });
    }
}
```

## Utils
#### {Client}.util.{Function}
### Functions include:
- generateEmbed
- getMessage
- getChannel
- getMember

## Logging
#### The core uses the Consola logging package, which provides info debug and success logs.

---
# That's it! Enjoy!

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