Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setHandler() {
this.app.hears(
'⚖️ Balance',
Composer.privateChat(async ctx => {
const { replyWithHTML } = ctx;
const userModel = new this.db.User();
const user = await userModel.getUser(ctx);
const marketModel = new this.db.Market();
const toUSD = await marketModel.calculate(user.balance, 'USD');
if (toUSD == 0) {
replyWithHTML(
`Your current balance:\n\n<b>${
user.balance
} XRP</b>\n\nYou can use deposit command to add more $XRP to your balance`,
);
} else {
replyWithHTML(
`Your current balance:\n\n<b>${</b>
setHandler() {
this.app.hears(CANCEL_TEXT, Composer.privateChat(this.Cancel));
this.app.hears(
'🔔 Notificaiton',
Composer.privateChat(async ctx => {
this.Menu(ctx);
}),
);
this.app.hears(
'ℹ️ Wallet Notify',
Composer.privateChat(async ctx => {
const { replyWithHTML } = ctx;
return replyWithHTML(
'Wallet Notify Settings',
Markup.keyboard([['➕ Add Wallet', '📇 Manage Wallets'], [CANCEL_TEXT]])
.resize()
.extra(),
);
}),
);
}
setHandler() {
this.app.hears(
'👥 Contact',
Composer.privateChat(async ctx => {
const { replyWithHTML } = ctx;
replyWithHTML(CONTACT, Extra.webPreview(false));
}),
);
}
}
setHandler() {
this.app.hears(
'📈 Market',
Composer.privateChat(async ctx => {
const { replyWithMarkdown } = ctx;
return replyWithMarkdown(await this.getResponse());
}),
);
this.app.command(
'market',
Composer.groupChat(async ctx => {
const { replyWithMarkdown } = ctx;
return replyWithMarkdown(await this.getResponse());
}),
);
}
}
setHandler() {
this.app.hears(
'⬇️ Deposit',
Composer.privateChat(async ctx => {
const { replyWithPhoto, replyWithHTML } = ctx;
const userModel = new this.db.User();
const user = await userModel.getUser(ctx);
const address = `https://ripple.com/send?to=${process.env.WALLET_ADDRESS}&dt=${user.telegramId}`;
let qrCode = `https://chart.googleapis.com/chart?chs=250x250&cht=qr&chl=${address}`;
replyWithPhoto(qrCode).then(() => {
replyWithHTML(
'Send XRP to the address & destination tag displayed below to add XRP to your balance\n' +
'\n⚠️ Please do not forget to enter your <b>Destination Tag</b> when sending your XRP! ',
).then(() =>
replyWithHTML(
`<b>Address: </b>\n<code>${
process.env.WALLET_ADDRESS
}</code>\n\n<b>Destination Tag: </b>\n<code>${user.telegramId}</code>`,
),
setHandler() {
this.app.hears(CANCEL_TEXT, Composer.privateChat(this.Cancel));
this.app.hears(
'🔔 Notificaiton',
Composer.privateChat(async ctx => {
this.Menu(ctx);
}),
);
this.app.hears(
'ℹ️ Wallet Notify',
Composer.privateChat(async ctx => {
const { replyWithHTML } = ctx;
return replyWithHTML(
'Wallet Notify Settings',
Markup.keyboard([['➕ Add Wallet', '📇 Manage Wallets'], [CANCEL_TEXT]])
.resize()
.extra(),
);