Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
init: custom welcome text
Browse files Browse the repository at this point in the history
  • Loading branch information
zill committed Oct 28, 2023
1 parent dfdf2f4 commit b707d82
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const config = {
token: botToken,
webHook: '/endpoint',
secret: "123456789wertyuiopxcvbnmDGHJKRTYIO", // A-Z, a-z, 0-9, _ and -
welcomeMessage() {
return `سلام به شما دوست گرامی! 🌟
welcomeMessage(customText) {
return customText || `سلام به شما دوست گرامی! 🌟
به ربات V2xBot خوش آمدید! 🎉 از اینکه اینجا هستید، بسیار خوشحالیم.
ما اینجا هستیم تا به شما کمک کنیم و هر سوال یا درخواستی که دارید را رفع کنیم.
Expand Down
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const admin = require("./models/admin");
const Admin = require('./models/admin');
const ClientApp = require('./models/client-app');
const Command = require('./models/command');
const App = require('./models/app');
const app = new App(db);

const DataModel = {Plan, Order, Payment, Server, ClientApp};

Expand Down Expand Up @@ -385,8 +387,8 @@ async function sendStartMessage(message, isAdmin, options = {}) {
[{text: '🛒 سوابق خرید', callback_data: 'order_history'}],
[{text: '🔗 مشاهده نرم‌افزار', callback_data: Command.list.selectClientApp.id}],
];

buttonRow = pushAdminButtons(buttonRow, isAdmin)

return await TlgBot.sendInlineButtonRow(chatId, Config.bot.welcomeMessage(), buttonRow, options)
}

Expand Down
21 changes: 21 additions & 0 deletions src/models/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict';

const Config = require('../config');
const Command = require('./command');

class app {
_db;
dbKey = "app"

constructor(db) {
this._db = db;
}

customWelcome = 'customWelcome';

async saveCustomWelcome(text) {
await this._db.update(this.dbKey, {[this.customWelcome]: text})
}
}

module.exports = app;

0 comments on commit b707d82

Please sign in to comment.