Exemple #1
0
def tagg_all_button(update, context):
    query = update.callback_query
    chat = update.effective_chat
    splitter = query.data.split('=')
    query_match = splitter[0]
    user_id = splitter[1]
    if query_match == "tagall_accept":
        if query.from_user.id == int(user_id):
            member = chat.get_member(int(user_id))
            chat_id = str(chat.id)[1:]
            REDIS.sadd(f'tagall2_{chat_id}',
                       mention_html(member.user.id, member.user.first_name))
            query.message.edit_text(
                "{} is accepted! to add yourself {}'s tag list.".format(
                    mention_html(member.user.id, member.user.first_name),
                    chat.title),
                parse_mode=ParseMode.HTML)

        else:
            context.bot.answer_callback_query(
                query.id, text="You're not the user being added in tag list!")
    elif query_match == "tagall_dicline":
        if query.from_user.id == int(user_id):
            member = chat.get_member(int(user_id))
            query.message.edit_text(
                "{} is deslined! to add yourself {}'s tag list.".format(
                    mention_html(member.user.id, member.user.first_name),
                    chat.title),
                parse_mode=ParseMode.HTML)
        else:
            context.bot.answer_callback_query(
                query.id, text="You're not the user being added in tag list!")
Exemple #2
0
def tagme(update, context):
    chat = update.effective_chat
    user = update.effective_user
    message = update.effective_message
    chat_id = str(chat.id)[1:]
    tagall_list = list(REDIS.sunion(f'tagall2_{chat_id}'))
    match_user = mention_html(user.id, user.first_name)
    if match_user in tagall_list:
        message.reply_text("You're already exist in {}'s tag list!".format(
            chat.title))
        return
    REDIS.sadd(f'tagall2_{chat_id}', mention_html(user.id, user.first_name))
    message.reply_text(
        "{} has been successfully added in {}'s tag list.".format(
            mention_html(user.id, user.first_name), chat.title),
        parse_mode=ParseMode.HTML)
Exemple #3
0
def animestuffs(update, context):
    query = update.callback_query
    user = update.effective_user
    splitter = query.data.split('=')
    query_match = splitter[0]
    callback_anime_data = splitter[1]
    if query_match == "xanime_watchlist":
        watchlist = list(REDIS.sunion(f'anime_watch_list{user.id}'))
        if not callback_anime_data in watchlist:
            REDIS.sadd(f'anime_watch_list{user.id}', callback_anime_data)
            context.bot.answer_callback_query(
                query.id,
                text=
                f"{callback_anime_data} is successfully added to your watch list.",
                show_alert=True)
        else:
            context.bot.answer_callback_query(
                query.id,
                text=
                f"{callback_anime_data} is already exists in your watch list!",
                show_alert=True)

    elif query_match == "xanime_fvrtchar":
        fvrt_char = list(REDIS.sunion(f'anime_fvrtchar{user.id}'))
        if not callback_anime_data in fvrt_char:
            REDIS.sadd(f'anime_fvrtchar{user.id}', callback_anime_data)
            context.bot.answer_callback_query(
                query.id,
                text=
                f"{callback_anime_data} is successfully added to your favorite character.",
                show_alert=True)
        else:
            context.bot.answer_callback_query(
                query.id,
                text=
                f"{callback_anime_data} is already exists in your favorite characters list!",
                show_alert=True)
    elif query_match == "xanime_manga":
        fvrt_char = list(REDIS.sunion(f'anime_mangaread{user.id}'))
        if not callback_anime_data in fvrt_char:
            REDIS.sadd(f'anime_mangaread{user.id}', callback_anime_data)
            context.bot.answer_callback_query(
                query.id,
                text=
                f"{callback_anime_data} is successfully added to your favorite character.",
                show_alert=True)
        else:
            context.bot.answer_callback_query(
                query.id,
                text=
                f"{callback_anime_data} is already exists in your favorite characters list!",
                show_alert=True)