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.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)) {
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
setHandler() {
this.app.command(
'help',
Composer.groupChat(ctx => {
const { replyWithMarkdown } = ctx;
return replyWithMarkdown(helpMsg);
}),
);
}
}
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;
}
}
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());
}),
);
}
}