Skip to content

Commit

Permalink
optimization & fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
melod1n committed Jan 7, 2022
1 parent 6d97c7d commit 707477a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 30 deletions.
Binary file modified data/database.sqlite
Binary file not shown.
4 changes: 2 additions & 2 deletions data/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"messagesReceived": 1197,
"messagesSent": 902,
"messagesReceived": 1203,
"messagesSent": 908,
"testAnswer": true,
"sendActionMessage": true
}
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"node-fetch": "^2.6.1",
"reflect-metadata": "^0.1.13",
"sql-template-strings": "^2.2.2",
"sqlite": "^4.0.23",
"sqlite3": "^5.0.2",
"systeminformation": "^5.6.1",
"ts-node": "^9.1.1",
Expand Down
12 changes: 4 additions & 8 deletions src/commands/about.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,15 @@ export class About extends Command {
random_id: 0,
disable_mentions: true
}).then(async () => {
await StorageManager.increaseSentMessagesCount();
if (!context.isChat) return;
await Api.sendMessage(context, 'Отправил информацию в ЛС 😎');
await context.reply('Отправил информацию в ЛС 😎');
});
} catch (e) {
console.error(`${TAG_ERROR}: help.ts: ${Utils.getExceptionText(e)}`);
console.error(`${TAG_ERROR}: about.ts: ${Utils.getExceptionText(e)}`);
if (e.code == 901) {
await Promise.all([
StorageManager.increaseSentMessagesCount(),
context.reply('Разрешите мне писать Вам сообщения 🥺')
]);
await context.reply('Разрешите мне писать Вам сообщения 🥺');
} else {
await Api.sendMessage(context, 'Не смог отправить информацию в ЛС ☹');
await context.reply('Не смог отправить информацию в ЛС ☹');
}
}
}
Expand Down
10 changes: 3 additions & 7 deletions src/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@ export class Help extends Command {
message: text,
random_id: 0
}).then(async () => {
await StorageManager.increaseSentMessagesCount();
if (!context.isChat) return;
await Api.sendMessage(context, 'Отправил команды в ЛС 😎');
await context.reply('Отправил команды в ЛС 😎');
});
} catch (e) {
console.error(`${TAG_ERROR}: help.ts: ${Utils.getExceptionText(e)}`);
if (e.code == 901) {
await Promise.all([
StorageManager.increaseSentMessagesCount(),
context.reply('Разрешите мне писать Вам сообщения 🥺')
]);
await context.reply('Разрешите мне писать Вам сообщения 🥺');
} else {
await Api.sendMessage(context, 'Не смог отправить команды в ЛС ☹');
await context.reply('Не смог отправить команды в ЛС ☹');
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {Offline} from './commands/offline';
import {AdminAdd, AdminRemove, AdminsList} from './commands/admins';
import {NoteAdd} from './commands/notes';
import {DatabaseManager, setDatabase} from './database/database-manager';
import {open} from 'sqlite';
import sqlite3 from 'sqlite3';
import {GroupsGroupFull} from 'vk-io/lib/api/schemas/objects';

Expand Down

0 comments on commit 707477a

Please sign in to comment.