예제 #1
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    rm_welcome_setting(event.chat_id)
    await edit_or_reply(event, " Hoşgeldin mesajı silindi. " +
                        "En son belirlenen hoşgeldin mesajı : `{}`.".format(cws.custom_welcome_message))
예제 #2
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    rm_welcome_setting(event.chat_id)
    await edit_or_reply(event ,"Welcome note cleared. " + \
        "The previous welcome message was `{}`.".format(cws.custom_welcome_message))
예제 #3
0
async def _(event):
    cws = get_current_welcome_settings(event.chat_id)
    if (cws and (event.user_joined or event.user_added)
            and not (await event.get_user()).bot):
        if Config.CLEAN_WELCOME:
            try:
                await bot.delete_messages(event.chat_id, cws.previous_welcome)
            except Exception as e:
                LOGS.warn(str(e))
        a_user = await event.get_user()
        chat = await event.get_chat()
        me = await bot.get_me()
        title = chat.title or "this chat"
        participants = await bot.get_participants(chat)
        count = len(participants)
        mention = "<a href='tg://user?id={}'>{}</a>".format(
            a_user.id, a_user.first_name)
        my_mention = "<a href='tg://user?id={}'>{}</a>".format(
            me.id, me.first_name)
        first = a_user.first_name
        last = a_user.last_name
        fullname = f"{first} {last}" if last else first
        username = f"@{a_user.username}" if a_user.username else mention
        userid = a_user.id
        my_first = me.first_name
        my_last = me.last_name
        my_fullname = f"{my_first} {my_last}" if my_last else my_first
        my_username = f"@{me.username}" if me.username else my_mention
        file_media = None
        current_saved_welcome_message = None
        if cws:
            if cws.f_mesg_id:
                msg_o = await event.client.get_messages(entity=BOTLOG_CHATID,
                                                        ids=int(cws.f_mesg_id))
                file_media = msg_o.media
                current_saved_welcome_message = msg_o.message
            elif cws.reply:
                current_saved_welcome_message = cws.reply
        current_message = await event.reply(
            current_saved_welcome_message.format(
                mention=mention,
                title=title,
                count=count,
                first=first,
                last=last,
                fullname=fullname,
                username=username,
                userid=userid,
                my_first=my_first,
                my_last=my_last,
                my_fullname=my_fullname,
                my_username=my_username,
                my_mention=my_mention,
            ),
            file=file_media,
            parse_mode="html",
        )
        update_previous_welcome(event.chat_id, current_message.id)
예제 #4
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    rm_welcome_setting(event.chat_id)
    await event.edit(
        "**⌔︙تم حذف ترحيب بنجاح ✅**" + \
        "**⌔︙رساله الترحيب السابقه هيه ↪️** `{}`.".format(cws.custom_welcome_message)
    )
예제 #5
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    rm_welcome_setting(event.chat_id)
    await event.edit(
        "تم محو ملاحظة الترحيب. " + \
        "كانت رسالة الترحيب السابقة `{}`.".format(cws.custom_welcome_message)
    )
예제 #6
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    rm_welcome_setting(event.chat_id)
    await event.edit(
        "Welcome eliminato. " + \
        "The previous welcome message was `{}`.".format(cws.custom_welcome_message)
    )
예제 #7
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    rm_welcome_setting(event.chat_id)
    await event.edit(
        "🗑️Messaggio di benvenuto, cancellato. " + \
        "Il vecchio messaggio di benvenuto era `{}`.".format(cws.custom_welcome_message)
    )
예제 #8
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    rm_welcome_setting(event.chat_id)
    await event.edit(
        "-  𖢞 Welcome cleared - @TeleOniOn. " + \
        "The previous welcome message was `{}`.".format(cws.custom_welcome_message)
    )
예제 #9
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    rm_welcome_setting(event.chat_id)
    await event.edit(
        "-@iqthon تم حذف ترحيب. " + \
        "رساله الترحيب السابقه هيه `{}`.".format(cws.custom_welcome_message)
    )
예제 #10
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if hasattr(cws, 'custom_welcome_message'):
        await edit_or_reply(event,
                            "Karşılama mesajı bulundu. " +
                            "Karşılama mesajınız:\n\n`{}`.".format(cws.custom_welcome_message))
    else:
        await edit_or_reply(event, "No Welcome Message found")
예제 #11
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if hasattr(cws, 'custom_welcome_message'):
        await edit_or_reply(event ,
            "Welcome note found. " + \
        "Your welcome message is\n\n`{}`.".format(cws.custom_welcome_message))
    else:
        await edit_or_reply(event, "No Welcome Message found")
예제 #12
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if hasattr(cws, 'custom_welcome_message'):
        await event.edit(
            "`kyne :`Welcome note found. " + \
        " welcome message is\n`{}`.".format(cws.custom_welcome_message)
        )
    else:
        await event.edit("`kyne :`No Welcome Message found")
예제 #13
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if hasattr(cws, 'custom_welcome_message'):
        await event.edit(
            "لايوجد لسته ترحيب. " + \
        "لسته ترحيب خاصه بك هيه\n\n`{}`.".format(cws.custom_welcome_message)
        )
    else:
        await event.edit("لايوجد لسته ترحيب")
예제 #14
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if hasattr(cws, 'custom_welcome_message'):
        await event.edit(
            "Welcome trovato. " + \
        "Il tuo welcome è\n\n`{}`.".format(cws.custom_welcome_message)
        )
    else:
        await event.edit("Nessun Welcome trovato")
예제 #15
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if hasattr(cws, 'custom_welcome_message'):
        await event.edit(
            "تم العثور على ملاحظة ترحيب. " + \
        "رسالتك الترحيبية هي\n\n`{}`.".format(cws.custom_welcome_message)
        )
    else:
        await event.edit("لم يتم العثور على رسالة ترحيب")
예제 #16
0
파일: welcome.py 프로젝트: Redkobra/catus
async def _(event):
    cws = get_current_welcome_settings(event.chat_id)
    if cws:
        if event.user_joined:
            if cws.should_clean_welcome:
                try:
                    await bot.delete_messages(  # pylint:disable=E0602
                        event.chat_id, cws.previous_welcome)
                except Exception as e:  # pylint:disable=C0103,W0703
                    logger.warn(str(e))  # pylint:disable=E0602

            cat = await bot.get_me()
            my_first = cat.first_name
            my_last = cat.last_name
            my_fullname = f"{my_first} {my_last}"
            my_mention = "[{}](tg://user?id={})".format(my_first, cat.id)
            my_username = f"@{cat.username}"
            a_user = await event.get_user()
            chat = await event.get_chat()
            me = await bot.get_me()
            title = chat.title if chat.title else "this chat"
            participants = await event.client.get_participants(chat)
            count = len(participants)
            mention = "[{}](tg://user?id={})".format(a_user.first_name,
                                                     a_user.id)
            first = a_user.first_name
            last = a_user.last_name
            if last:
                fullname = f"{first} {last}"
            else:
                fullname = first
            username = f"@{me.username}" if me.username else f"[Me](tg://user?id={me.id})"
            userid = a_user.id
            current_saved_welcome_message = cws.custom_welcome_message
            mention = "[{}](tg://user?id={})".format(a_user.first_name,
                                                     a_user.id)
            current_message = await event.reply(
                current_saved_welcome_message.format(mention=mention,
                                                     title=title,
                                                     count=count,
                                                     first=first,
                                                     last=last,
                                                     fullname=fullname,
                                                     username=username,
                                                     userid=userid,
                                                     my_first=my_first,
                                                     my_fullname=my_fullname,
                                                     my_last=my_last,
                                                     my_mention=my_mention,
                                                     my_username=my_username),
                file=cws.media_file_id)
            update_previous_welcome(event.chat_id, current_message.id)
예제 #17
0
async def _(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if hasattr(cws, 'custom_welcome_message'):
        await event.edit(
            "🔍Messaggio di benvenuto, trovato. " + \
        "🗃️Il tuo messaggio di benvenuto è\n\n`{}`.".format(cws.custom_welcome_message)
    )
    else:
        await event.edit(
            "📭Nessun messaggio di benvenuto, trovato"
        )
예제 #18
0
async def show_welcome(event):
    cws = get_current_welcome_settings(event.chat_id)
    if not cws:
        await edit_or_reply(event, "`No welcome message saved here.`")
        return
    if cws.f_mesg_id:
        msg_o = await bot.get_messages(entity=BOTLOG_CHATID, ids=int(cws.f_mesg_id))
        await edit_or_reply(
            event, "`I am currently welcoming new users with this welcome note.`"
        )
        await event.reply(msg_o.message, file=msg_o.media)
    elif cws.reply:
        await edit_or_reply(
            event, "`I am currently welcoming new users with this welcome note.`"
        )
        await event.reply(cws.reply)
예제 #19
0
async def show_welcome(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if not cws:
        await edit_or_reply(event, "`𖠕  لايـوجد لديـك هـنا تـرحيب ↫`")
        return
    if cws.f_mesg_id:
        msg_o = await bot.get_messages(entity=BOTLOG_CHATID, ids=int(cws.f_mesg_id))
        await edit_or_reply(
            event, "`↫ أرحب حاليًا بالمستخدمين الجدد بهذه الملاحظة الترحيبية`"
        )
        await event.reply(msg_o.message, file=msg_o.media)
    elif cws.reply:
        await edit_or_reply(
            event, "`↫ أرحب حاليًا بالمستخدمين الجدد بهذه الملاحظة الترحيبية.`"
        )
        await event.reply(cws.reply)
예제 #20
0
async def show_welcome(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if not cws:
        await edit_or_reply(event, "**لاتوجد رساله ترحيب محفوظة هنا**")
        return
    if cws.f_mesg_id:
        msg_o = await bot.get_messages(entity=BOTLOG_CHATID,
                                       ids=int(cws.f_mesg_id))
        await edit_or_reply(
            event,
            "**أرحب حاليًا بالمستخدمين الجدد بهذه الرساله الترحيبية.🜝**")
        await event.reply(msg_o.message, file=msg_o.media)
    elif cws.reply:
        await edit_or_reply(
            event,
            "**أرحب حاليًا بالمستخدمين الجدد بهذه الرساله الترحيبية.🜝**")
        await event.reply(cws.reply)
예제 #21
0
파일: welcome.py 프로젝트: Akarata/test
async def show_welcome(event):
    if event.fwd_from:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if not cws:
        await edit_or_reply(
            event, "`Tidak ada pesan selamat datang yang disimpan di sini.`"
        )
        return
    if cws.f_mesg_id:
        msg_o = await bot.get_messages(entity=BOTLOG_CHATID, ids=int(cws.f_mesg_id))
        await edit_or_reply(
            event,
            "`Saya saat ini menyambut pengguna baru dengan catatan selamat datang ini.`",
        )
        await event.reply(msg_o.message, file=msg_o.media)
    elif cws.reply:
        await edit_or_reply(
            event,
            "`Saya saat ini menyambut pengguna baru dengan catatan selamat datang ini.`",
        )
        await event.reply(cws.reply)