File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const api = new Topgg.Api('Your top.gg token')
3838<a name =" Api+postStats " ></a >
3939
4040### api.postStats(stats) ⇒ <code >BotStats</code >
41- Post bot stats to Top.gg (Do not use if you supplied a client)
41+ Post bot stats to Top.gg
4242
4343** Kind** : instance method of [ <code >Api</code >] ( #Api )
4444** Returns** : <code >BotStats</code > - Passed object
Original file line number Diff line number Diff line change @@ -24,15 +24,11 @@ import { WebhookPayload } from '../typings'
2424 * // Authorization: webhookauth123
2525 */
2626export class Webhook {
27- private auth : string
28-
2927 /**
3028 * Create a new webhook client instance
3129 * @param authorization Webhook authorization to verify requests
3230 */
33- constructor ( authorization ?: string ) {
34- this . auth = authorization
35- }
31+ constructor ( private authorization ?: string ) { }
3632
3733 private _formatIncoming ( body ) : WebhookPayload {
3834 if ( body ?. query ?. length > 0 ) body . query = qs . parse ( body . query . substr ( 1 ) )
@@ -41,7 +37,7 @@ export class Webhook {
4137
4238 private _parseRequest ( req , res ) : Promise < WebhookPayload | false > {
4339 return new Promise ( resolve => {
44- if ( this . auth && req . headers . authorization !== this . auth ) return res . status ( 403 ) . json ( { error : 'Unauthorized' } )
40+ if ( this . authorization && req . headers . authorization !== this . authorization ) return res . status ( 403 ) . json ( { error : 'Unauthorized' } )
4541 // parse json
4642
4743 if ( req . body ) return resolve ( this . _formatIncoming ( req . body ) )
@@ -72,7 +68,7 @@ export class Webhook {
7268 return async ( req , res , next ) => {
7369 const response = await this . _parseRequest ( req , res )
7470 if ( ! response ) return
75- res . sendStatus ( 200 )
71+ res . sendStatus ( 204 )
7672 req . vote = response
7773 next ( )
7874 }
You can’t perform that action at this time.
0 commit comments