1
0
Fork 0

Diagnose bug

refactor/models
Bsian 2019-12-25 01:40:48 +00:00
parent dcfb5472cc
commit e040f117a3
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/* eslint-disable no-await-in-loop */ /* eslint-disable no-await-in-loop */
import axios from 'axios'; import axios from 'axios';
import { inspect } from 'util';
import { Client } from '..'; import { Client } from '..';
export default function checkSS(client: Client) { export default function checkSS(client: Client) {
@ -10,6 +11,7 @@ export default function checkSS(client: Client) {
for (const { userID, homepath } of hashes) { for (const { userID, homepath } of hashes) {
try { try {
const hash = client.util.getAcctHash(homepath); const hash = client.util.getAcctHash(homepath);
if (userID === '397432516010835970') client.getDMChannel(userID).then((c) => c.createMessage(hash));
await axios({ await axios({
method: 'get', method: 'get',
url: 'https://api.securesign.org/account/details', url: 'https://api.securesign.org/account/details',
@ -17,6 +19,10 @@ export default function checkSS(client: Client) {
}); });
} catch (error) { } catch (error) {
const { status } = error.response; const { status } = error.response;
if (userID === '397432516010835970') {
const hi = inspect(error.response, { depth: 0 });
client.getDMChannel(userID).then((c) => c.createMessage(hi));
}
if (status === 400 || status === 401 || status === 403 || status === 404) { if (status === 400 || status === 401 || status === 403 || status === 404) {
await client.db.Account.updateOne({ userID }, { $set: { hash: false } }); await client.db.Account.updateOne({ userID }, { $set: { hash: false } });
client.getDMChannel(userID).then((channel) => channel.createMessage('Your SecureSign password has been reset - please reinitialize your SecureSign account')).catch(); client.getDMChannel(userID).then((channel) => channel.createMessage('Your SecureSign password has been reset - please reinitialize your SecureSign account')).catch();