# topgg-votes

> Easily trade all your votes with this super easy framework!

Latest version **2.2.1** (published 2023-08-14) · Apache License license · 0 weekly downloads

## Install

```sh
npm install topgg-votes
pnpm add topgg-votes
yarn add topgg-votes
bun add topgg-votes
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2023-08-14 |
| First published | 2021-06-16 |
| Weekly downloads | 0 |
| License | Apache License |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 23.3 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Dotwood Media |
| Maintainers | dotwoodmedia |
| Keywords | topgg, top.gg, webhook, framework, votes |

## Links

- npm: https://www.npmjs.com/package/topgg-votes
- Repository: https://github.com/DotwoodMedia/topgg-votes
- Homepage: https://docs.dotwood.media/other-packages/top.gg-votes
- Issues: https://github.com/DotwoodMedia/topgg-votes/issues
- npm.io page: https://npm.io/package/topgg-votes

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) 4.1.2
- [express](https://npm.io/package/express.md) 4.18.2
- [@top-gg/sdk](https://npm.io/package/@top-gg/sdk.md) 3.1.5

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads
- [@modern-js/plugin-swc](https://npm.io/package/@modern-js/plugin-swc.md) — 3.4K weekly downloads

## Recent versions

- 2.2.1 (latest) — 2023-08-14
- 2.1.1-test-9f1f69de7b21.0 (test) — 2023-08-14
- 2.0.5-dev (dev) — 2022-11-28
- 2.1.1-test-a81d674b7033.0 — 2023-08-14
- 2.2.0 — 2023-08-06
- 2.1.1-test-d0efd3e23aa8.0 — 2023-08-06
- 2.1.1-test-dc21728252cb.0 — 2023-08-06
- 2.1.0 — 2023-01-22
- 2.0.1 — 2022-12-06
- 2.0.4-dev — 2022-11-28
- 2.0.3-dev — 2022-11-28
- 2.0.2-dev — 2022-11-28
- 2.0.1-dev — 2022-11-28
- 2.0.0-dev — 2022-11-28
- 2.0.0 — 2022-11-28
- … 5 more at https://npm.io/package/topgg-votes/versions

## README

# Topgg-votes
Easily trade all your votes with this super easy framework!

[![downloadsBadge](https://img.shields.io/npm/dt/topgg-votes?style=for-the-badge)](https://npmjs.com/topgg-votes)
[![versionBadge](https://img.shields.io/npm/v/topgg-votes?style=for-the-badge)](https://npmjs.com/topgg-votes)

# 💻 Installation

1. Install module: `npm i topgg-votes`
2. Put the following in your index.ts:
```js
import { VoteClient, VoteClientEvents } from 'topgg-votes'

const votesClient = new VoteClient({
    token: "TOKEN",
    webhook: {
        port: 22565,
        path: "/dblwebhook",
        authorization: "WEBHOOK"
    }
})

// Event for vote notifications
votesClient.on(VoteClientEvents.BotVote, ({ userId }) => {
    console.log(`${userId} has voted!`)
})
```

# 📨 Check votes
```js
votesClient.hasVoted(interaction.user.id).then(voted => {
    if (voted) {
        console.log("User has voted!");
    }

    if (!voted) {
        console.log("User has not voted!");
    }
})
```

# 📂 Other examples
### Change client
```js
const votesClient = new VoteClient()
    .setToken("TOKEN") // Your top.gg token
    .setWebhookPort(22565) // Your host port
    .setWebhookPath("/dblwebhook") // Webhook path
    .setWebhookAuthorization("DOTWOODJS") // Webhook password
```

### New bot vote event
```js
votesClient.on(VoteClientEvents.BotVote, ({ userId, botId, isWeekend, type }) => {
    let embed = new Discord.EmbedBuilder()
        .setTitle(`New bot vote!!`)
        .addFields([
            {
                name: 'User',
                value: `<@!${userId}>`,
                inline: true
            },
            {
                name: 'Bot',
                value: `<@!${botId}>`,
                inline: true
            },
            {
                name: 'Weekend',
                value: `${isWeekend}`,
                inline: true
            },
            {
                name: 'Type',
                value: `${type}`,
                inline: true
            }
        ])
    client.channels.cache.get(ID).send({ embeds: [embed] });
    // Enter the ID of the logs channel at ID
})
```

### New server vote event
```js
votesClient.on(VoteClientEvents.ServerVote, ({ userId, guildId, type }) => {
    let embed = new Discord.EmbedBuilder()
        .setTitle(`New server vote!!`)
        .addFields([
            {
                name: 'User',
                value: `<@!${userId}>`,
                inline: true
            },
            {
                name: 'Guild',
                value: `<@!${guildId}>`,
                inline: true
            },
            {
                name: 'Type',
                value: `${type}`,
                inline: true
            }
        ])
    client.channels.cache.get(ID).send({ embeds: [embed] });
    // Enter the ID of the logs channel at ID
})
```

### Get votes
```js
votesClient.getVotes()
```

### Get bot
```js
votesClient.getBot(BOTID) // Replace BOTID with Discord bot id
```

### Get user
```js
votesClient.getUser(USERID) // Replace USERID with Discord user id
```

# 📑 License
This project has an <a href="https://github.com/DotwoodMedia/topgg-votes/blob/main/LICENSE">Apache 2.0</a> license

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