all repos — gif-escarbot @ 4362f8afce12cb56ab2d30549c9c22b0fa046411

Earthbound Café's custom delivery bot with other cool utilities built-in.

use vxtiktok, link emoji
BiRabittoh andronacomarco@gmail.com
Mon, 18 Sep 2023 16:34:45 +0200
commit

4362f8afce12cb56ab2d30549c9c22b0fa046411

parent

1cec45161bad20ac219224ba9734fe70eefc2de6

1 files changed, 10 insertions(+), 12 deletions(-)

jump to
M escarbot/replace.pyescarbot/replace.py

@@ -53,28 +53,26 @@ "becomes": "https://ddinstagram.com/{}/{}",

}, { "regex": re.compile(r"(?:https?:\/\/)?(?:(?:www)|(?:vm))?\.?tiktok\.com\/@([\w\d_.]+)\/(?:video)\/(\d+)", re_flags), - "becomes": "https://www.tnktok.com/@{}/video/{}", + "becomes": "https://www.vxtiktok.com/@{}/video/{}", }, { "regex": re.compile(r"(?:https?:\/\/)?(?:(?:www)|(?:vm))?\.?tiktok\.com\/([\w]+)\/?", re_flags), - "becomes": "https://vm.tnktok.com/{}/", + "becomes": "https://vm.vxtiktok.com/{}/", }, ] -link_message = "Da {}[\.]({}) {}" +link_message = "[🔗]({}) Da {}\. {}" def get_callback_data(feedback: bool) -> str: payload = { "feedback": feedback } return "feedback" + INLINE_SEP + json.dumps(payload) -def get_message_markup() -> InlineKeyboardMarkup: - buttons = [ - [ - InlineKeyboardButton(text="✅", callback_data=get_callback_data(True)), - InlineKeyboardButton(text="❌", callback_data=get_callback_data(False)), - ] +buttons = InlineKeyboardMarkup([ + [ + InlineKeyboardButton(text="✅", callback_data=get_callback_data(True)), + InlineKeyboardButton(text="❌", callback_data=get_callback_data(False)), ] - return InlineKeyboardMarkup(buttons) +]) def format_template(template: str, regex_result) -> str: result_type = type(regex_result)

@@ -113,11 +111,11 @@

for link in links: logger.info(link) user = update.effective_user.mention_markdown_v2(update.effective_user.name) - text = link_message.format(user, link[0], link[1]) + text = link_message.format(link[0], user, link[1]) chat = update.effective_chat message = await chat.send_message(text, parse_mode=ParseMode.MARKDOWN_V2, message_thread_id=message.message_thread_id) await sleep(FEEDBACK_TIMEOUT) - await message.edit_reply_markup(reply_markup=get_message_markup()) + await message.edit_reply_markup(reply_markup=buttons) async def feedback(update: Update, _, data_json: str) -> None: data = json.loads(data_json)