Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps,actions: update deps and make tweaks #75

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [12, 14]
node: [14, 16, 18]
steps:
- uses: actions/checkout@master
- name: Cache node modules
uses: actions/cache@v2
- uses: actions/checkout@v3
- name: Cache node_modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
Expand All @@ -25,12 +25,13 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup node
uses: actions/setup-node@v1
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
check-latest: true
registry-url: https://registry.npmjs.org/
- name: Compile typescript
- name: Compile TypeScript
run: npm run build:ci
- name: Lint typescript
- name: Lint TypeScript
run: npm run lint:ci
11 changes: 6 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 18
check-latest: true
registry-url: https://registry.npmjs.org/
- run: npm publish --unsafe-perm
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_SECRET}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_SECRET }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ typings/
.tern-port
package-lock.json
yarn.lock
eslint_report.json
eslint_report.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.9.0
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,36 @@ You can also setup webhooks via Topgg.Webhook, look down below at the examples f
If you're looking for an easy way to post your bot's stats (server count, shard count), check out [`topgg-autoposter`](https://npmjs.com/package/topgg-autoposter)

```js
const client = Discord.Client() // Your discord.js client or any other
const { AutoPoster } = require('topgg-autoposter')
const client = Discord.Client(); // Your discord.js client or any other
const { AutoPoster } = require("topgg-autoposter");

AutoPoster('topgg-token', client)
.on('posted', () => {
console.log('Posted stats to Top.gg!')
})
AutoPoster("topgg-token", client).on("posted", () => {
console.log("Posted stats to Top.gg!");
});
```

With this your server count and shard count will be posted to Top.<span>gg

## Webhook server

```js
const express = require('express')
const Topgg = require('@top-gg/sdk')
const express = require("express");
const Topgg = require("@top-gg/sdk");

const app = express() // Your express app
const app = express(); // Your express app

const webhook = new Topgg.Webhook('topggauth123') // add your Top.gg webhook authorization (not bot token)
const webhook = new Topgg.Webhook("topggauth123"); // add your Top.gg webhook authorization (not bot token)

app.post('/dblwebhook', webhook.listener(vote => {
// vote is your vote object
console.log(vote.user) // 221221226561929217
})) // attach the middleware
app.post(
"/dblwebhook",
webhook.listener((vote) => {
// vote is your vote object
console.log(vote.user); // 221221226561929217
})
); // attach the middleware

app.listen(3000) // your port
app.listen(3000); // your port
```

With this example, your webhook dashboard should look like this:
![](https://i.imgur.com/wFlp4Hg.png)
37 changes: 18 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@top-gg/sdk",
"version": "3.1.3",
"version": "3.1.4",
"description": "Official Top.gg Node SDK",
"main": "./dist/index.js",
"scripts": {
"build": "tsc",
"build:ci": "npm i --also=dev && tsc",
"build:ci": "npm i --include=dev && tsc",
"docs": "typedoc",
"prepublishOnly": "npm run build:ci",
"lint": "eslint src/**/*.ts",
Expand All @@ -23,25 +23,24 @@
},
"homepage": "https://topgg.js.org",
"devDependencies": {
"@top-gg/eslint-config": "^0.0.2",
"@types/express": "^4.17.11",
"@types/node": "^14.14.41",
"@types/node-fetch": "^2.5.10",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"eslint": "^7.27.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-jest": "^24.3.6",
"express": "^4.17.1",
"husky": "^6.0.0",
"lint-staged": "^11.0.0",
"prettier": "^2.3.0",
"typedoc": "^0.21.0",
"typescript": "^4.4.4"
"@top-gg/eslint-config": "^0.0.3",
"@types/express": "^4.17.17",
"@types/node": "^18.15.5",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"eslint": "^8.36.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-jest": "^27.2.1",
"express": "^4.18.2",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"prettier": "^2.8.6",
"typedoc": "^0.23.28",
"typescript": "^5.0.2"
},
"dependencies": {
"node-fetch": "^2.6.1",
"raw-body": "^2.4.1"
"raw-body": "^2.5.2",
"undici": "^5.21.0"
},
"types": "./dist/index.d.ts"
}
Loading