Skip to content

Commit

Permalink
🔀 Merge pull request #1136 from TF2Autobot/small_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
idinium96 authored Jun 1, 2022
2 parents 8264ac0 + 53b3cec commit 7469287
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/classes/Commands/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export default class Commands {
'✋ Hold on',
'Hold on',
'Sending',
'Checking', // for "Checking out..." phrase from gladiator
'👋 Welcome',
'Welcome',
'To',
Expand Down
8 changes: 4 additions & 4 deletions src/classes/MyHandler/MyHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2432,7 +2432,7 @@ export default class MyHandler extends Handler {
? this.opt.customMessage.welcome
.replace(/%name%/g, '')
.replace(/%admin%/g, isAdmin ? '!help' : '!how2trade')
: `Hi! If you don't know how things work, please type "!` + (isAdmin ? 'help' : 'how2trade')
: `Hi! If you don't know how things work, please type "!${isAdmin ? 'help' : 'how2trade'}"`
);
}

Expand All @@ -2452,8 +2452,8 @@ export default class MyHandler extends Handler {
? this.opt.customMessage.welcome
.replace(/%name%/g, friend.player_name)
.replace(/%admin%/g, isAdmin ? '!help' : '!how2trade')
: `Hi ${friend.player_name}! If you don't know how things work, please type "!` +
(isAdmin ? 'help' : 'how2trade')
: `Hi ${friend.player_name}! If you don't know how things work, please type ` +
`"!${isAdmin ? 'help' : 'how2trade'}"`
);
});
}
Expand Down Expand Up @@ -2664,7 +2664,7 @@ export default class MyHandler extends Handler {
}

onDeleteArchivedListingError(err: Error): void {
log.debug('Error on delete archived listings:', err);
log.error('Error on delete archived listings:', err);
}
}

Expand Down
25 changes: 11 additions & 14 deletions src/lib/pricer/pricestf/prices-tf-api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import axios, { AxiosRequestConfig, Method } from 'axios';
import axios, { AxiosRequestConfig, Method, AxiosError } from 'axios';
import { PricerOptions } from '../../../classes/IPricer';
import log from '../../logger';

export interface PricesTfRequestCheckResponse {
enqueued: boolean;
Expand Down Expand Up @@ -56,22 +57,18 @@ export default class PricesTfApi {
await this.setupToken();
}

return await PricesTfApi.apiRequest(
httpMethod,
path,
params,
{},
{
Authorization: 'Bearer ' + this.token,
...headers
}
);
return await PricesTfApi.apiRequest(httpMethod, path, params, data, {
Authorization: 'Bearer ' + this.token,
...headers
});
} catch (e) {
if (e && 401 === e['statusCode'] ? e['statusCode'] : e['status']) {
const err = e as AxiosError;
if (err.response && err.response.status === 401) {
log.debug('Requesting new token from prices.tf due to 401');
await this.setupToken();
return this.authedApiRequest(httpMethod, path, params, {}, headers);
return this.authedApiRequest(httpMethod, path, params, data, headers);
}
throw e;
throw err;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/lib/pricer/pricestf/prices-tf-pricer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export default class PricesTfPricer implements IPricer {
const pricelist = await PricesTfApi.apiRequest(
'GET',
'/json/pricelist-array',
{},
{},
{},
undefined,
undefined,
undefined,
'https://autobot.tf'
);

Expand Down

0 comments on commit 7469287

Please sign in to comment.