How to use the telegraf.Composer.privateChat function in telegraf

To help you get started, we’ve selected a few telegraf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github N3TC4T / xrp-telegram-bot / handlers / others / balance.js View on Github external
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>
github N3TC4T / xrp-telegram-bot / handlers / others / notification.js View on Github external
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(),
                );
            }),
        );
    }
github N3TC4T / xrp-telegram-bot / handlers / others / contact.js View on Github external
setHandler() {
        this.app.hears(
            '👥 Contact',
            Composer.privateChat(async ctx => {
                const { replyWithHTML } = ctx;
                replyWithHTML(CONTACT, Extra.webPreview(false));
            }),
        );
    }
}
github N3TC4T / xrp-telegram-bot / handlers / others / market.js View on Github external
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());
            }),
        );
    }
}
github N3TC4T / xrp-telegram-bot / handlers / others / deposit.js View on Github external
setHandler() {
        this.app.hears(
            '⬇️ Deposit',
            Composer.privateChat(async ctx =&gt; {
                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}&amp;dt=${user.telegramId}`;
                let qrCode = `https://chart.googleapis.com/chart?chs=250x250&amp;cht=qr&amp;chl=${address}`;
                replyWithPhoto(qrCode).then(() =&gt; {
                    replyWithHTML(
                        'Send XRP to the address &amp; 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(() =&gt;
                        replyWithHTML(
                            `<b>Address: </b>\n<code>${
                                process.env.WALLET_ADDRESS
                            }</code>\n\n<b>Destination Tag: </b>\n<code>${user.telegramId}</code>`,
                        ),
github N3TC4T / xrp-telegram-bot / handlers / others / notification.js View on Github external
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(),
                );