This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config(); | |
const Telegraf = require('telegraf'); | |
const Extra = require('telegraf/extra'); | |
const Markup = require('telegraf/markup'); | |
const bot = new Telegraf(process.env.BOT_TOKEN); | |
bot.action(/delete_message_(.+)/, (context) => { | |
const messageId = context.match[1]; | |
context.deleteMessage(messageId); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.products-list { | |
display: flex; | |
flex-wrap: wrap; | |
justify-content: space-between; | |
margin-bottom: -80px; | |
@include sm-down { | |
margin-bottom: -40px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let productsListsMasonries = []; | |
const initProductsListsMasonries = () => { | |
const masonryOptions = { | |
itemSelector: '.products-list__product-card', | |
columnWidth: '.products-list__grid-sizer', | |
percentPosition: true, | |
gutter: getWindowOuterWidth() >= 768 ? 80 : 40, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Markup = require('telegraf/markup'); | |
const { ACTION_NAMES } = require('../constants'); | |
const generatePostKeyboard = (id, removeCaption) => Markup.inlineKeyboard([ | |
[ | |
removeCaption ? | |
Markup.callbackButton('🖍 Remove caption', `${ACTION_NAMES.remove_post_caption.string}_${id}`) | |
: | |
Markup.callbackButton('✏️ Return caption', `${ACTION_NAMES.return_post_caption.string}_${id}`), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ACTION_NAMES = { | |
approve_post: { | |
regexp: /a_p_(.+)/, | |
string: 'a_p' | |
}, | |
dismiss_post: { | |
regexp: /d_p_(.+)/, | |
string: 'd_p' | |
}, | |
approve_post_confirmation: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bot.telegram.sendVideo('', '', { | |
reply_markup: { | |
inline_keyboard: [ | |
[ | |
{ | |
text: 'Remove caption', | |
callback_data: `remove_post_caption_${id}`, | |
}, | |
], | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const UglifyJsPlugin = require('uglify-js-plugin'); | |
module.exports = { | |
target: 'node', | |
mode: 'production', | |
entry: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
telegram.getUserProfilePhotos(user.id, 0, 1).then((response) => { | |
const photos = response.photos; | |
const photo = photos[0]; | |
const largePhoto = photo[2]; | |
telegram.getFileLink(largePhoto.file_id).then((avatarLink) => { | |
axios.get(avatarLink).then((avatar) => { | |
const form = new FormData(); | |
form.append('data', new Buffer.from(avatar.data), { | |
filename: 'example.jpg', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// post options | |
const options = { | |
reply_markup: { | |
inline_keyboard: [ | |
[ | |
{ | |
text: 'Remove caption', | |
callback_data: 'remove_post_caption', | |
}, | |
], |