Skip to content

Commit

Permalink
✂️ Added replaceAll func
Browse files Browse the repository at this point in the history
  • Loading branch information
NightStrang6r committed Feb 2, 2023
1 parent ae5753b commit 162ba30
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function loadConfig() {
autoIssue: Number(config.get('FunPay', 'autoDelivery')),
autoResponse: Number(config.get('FunPay', 'autoResponse')),
greetingMessage: Number(config.get('FunPay', 'greetingMessage')),
greetingMessageText: config.get('FunPay', 'greetingMessageText').replace('\\n', '\n'),
greetingMessageText: replaceAll(config.get('FunPay', 'greetingMessageText'), '\\n', '\n'),
autoIssueTestCommand: Number(config.get('FunPay', 'autoDeliveryTestCommand')),
watermark: config.get('FunPay', 'waterMark'),
telegramBot: Number(config.get('Telegram', 'enabled')),
Expand Down Expand Up @@ -289,6 +289,10 @@ async function loadAutoIssueFile() {
return await fs.readFile(`${_dirname}/data/configs/delivery.json`, 'utf8');
}

function replaceAll(string, find, replace) {
return string.replace(new RegExp(find, 'g'), replace);
}

async function askSettings() {
const question1 = await inq.prompt([{
name: 'golden_key',
Expand Down Expand Up @@ -453,7 +457,7 @@ async function askSettings() {
lotsRaiseNotification: (question5.lotsRaiseNotification == 'Да') ? 1 : 0,
deliveryNotification: (question5.deliveryNotification == 'Да') ? 1 : 0,
greetingMessage: (answers.greetingMessage == 'Да') ? 1 : 0,
greetingMessageText: 'Привет! Продавец скоро ответит на твоё сообщение.'
greetingMessageText: 'Привет, {name}!\nПродавец скоро ответит на твоё сообщение.'
}

console.log();
Expand Down

0 comments on commit 162ba30

Please sign in to comment.