How to use the telegraf.Composer.groupChat 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 / commands / tip.js View on Github external
setHandler() {
        this.app.command(
            ['tip', 'xrp'],
            Composer.groupChat(async ctx => {
                const { replyWithHTML } = ctx;
                const args = ctx.state.command.splitArgs;
                const { command } = ctx.state.command;
                const self = this;

                let chat = null;
                if (ctx.updateType === 'callback_query') {
                    chat = ctx.update.callback_query.message.chat;
                } else {
                    if (_.has(ctx, ['update', 'message', 'chat'])) {
                        chat = ctx.update.message.chat;
                    }
                }

                // exclude groups with certain ids
                if (command === 'tip' && EXCLUDE_GROUPS.includes(chat.id)) {
github N3TC4T / xrp-telegram-bot / handlers / commands / airdrop.js View on Github external
setHandler() {
        this.app.command(
            ['airdrop'],
            Composer.groupChat(async ctx => {
                const { replyWithHTML } = ctx;

                const args = ctx.state.command.splitArgs;

                const self = this;

                if (args.length > 2) {
                    return;
                }

                const admins = await ctx.getChatAdministrators();
                if (!admins.some(adm => adm.user.id === ctx.from.id)) {
                    return replyWithHTML(`⚠️  Just admins can run Airdrops!`);
                }

                // check stuff
github N3TC4T / xrp-telegram-bot / handlers / commands / help.js View on Github external
setHandler() {
        this.app.command(
            'help',
            Composer.groupChat(ctx => {
                const { replyWithMarkdown } = ctx;
                return replyWithMarkdown(helpMsg);
            }),
        );
    }
}
github N3TC4T / xrp-telegram-bot / handlers / commands / subscribe.js View on Github external
if (result) {
                        replyWithMarkdown(
                            `Successfully ***subscribe*** to XRP Community Blog.\nFor unsubscribe please use \/unsubscribe command`,
                        );
                    } else {
                        replyWithMarkdown(
                            `Already ***subscribed*** to XRP Community Blog!\nFor unsubscribe please use \/unsubscribe command`,
                        );
                    }
                }),
            ),
        );

        this.app.command(
            'unsubscribe',
            Composer.groupChat(
                admin(async ctx => {
                    const { replyWithMarkdown } = ctx;
                    let from = null;
                    let update = null;

                    const chat_type = _.get(ctx, ['update', 'message', 'chat', 'type']);

                    if (chat_type !== 'private') {
                        let chat = null;
                        if (ctx.updateType === 'callback_query') {
                            chat = ctx.update.callback_query.message.chat;
                        } else {
                            if (_.has(ctx, ['update', 'message', 'chat'])) {
                                chat = ctx.update.message.chat;
                            }
                        }
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());
            }),
        );
    }
}