Ejemplo n.º 1
0
async def blacklist_init():
    try:
        import sedenbot.moduller.sql_helper.blacklist_sql as sql
    except:
        LOGS.warn(
            'Karaliste özelliği çalıştırılamıyor, SQL bağlantısı bulunamadı')
        sql = None
Ejemplo n.º 2
0
def blacklist_init():
    try:
        global sql
        sql = import_module('sedenecem.sql.blacklist_sql')
    except Exception as e:
        sql = None
        LOGS.warn('Karaliste özelliği çalıştırılamıyor, SQL bağlantısı bulunamadı')
Ejemplo n.º 3
0
async def blacklist_init():
    try:
        global sql
        sql = import_module("sedenbot.moduller.sql_helper.blacklist_sql")
    except:
        sql = None
        LOGS.warn(
            'Karaliste özelliği çalıştırılamıyor, SQL bağlantısı bulunamadı')
Ejemplo n.º 4
0
def pmpermit_init():
    try:
        global sql
        from importlib import import_module
        sql = import_module('sedenecem.sql.pm_permit_sql')
    except Exception as e:
        sql = None
        LOGS.warn(f'{get_translation("pmpermitSqlLog")}')
        raise e
Ejemplo n.º 5
0
def notes_init():
    try:
        global sql
        from importlib import import_module
        sql = import_module('sedenecem.sql.notes_sql')
    except Exception as e:
        sql = None
        LOGS.warn(get_translation('notesSqlLog'))
        raise e
Ejemplo n.º 6
0
def snips_init():
    try:
        global sql
        from importlib import import_module
        sql = import_module('sedenecem.sql.snips_sql')
    except Exception as e:
        sql = None
        LOGS.warn(f'{get_translation("snipsSqlLog")}')
        raise e
Ejemplo n.º 7
0
def blacklist_init():
    try:
        global sql
        from importlib import import_module
        sql = import_module('sedenecem.sql.blacklist_sql')
    except Exception as e:
        sql = None
        LOGS.warn(get_translation('blacklistSqlLog'))
        raise e
Ejemplo n.º 8
0
def chat_init():
    try:
        global sql
        from importlib import import_module
        sql = import_module('sedenecem.sql.keep_read_sql')
    except Exception as e:
        sql = None
        LOGS.warn(get_translation('chatSqlLog'))
        raise e
Ejemplo n.º 9
0
def globals_init():
    try:
        global sql, sql2
        from importlib import import_module

        sql = import_module('sedenecem.sql.gban_sql')
        sql2 = import_module('sedenecem.sql.gmute_sql')
    except Exception as e:
        sql = None
        sql2 = None
        LOGS.warn(get_translation('globalsSqlLog'))
        raise e
Ejemplo n.º 10
0
async def welcome_to_chat(event):
    try:
        from sedenbot.moduller.sql_helper.welcome_sql import get_current_welcome_settings
        from sedenbot.moduller.sql_helper.welcome_sql import update_previous_welcome
    except:
        return
    cws = get_current_welcome_settings(event.chat_id)
    if cws:
        """user_added=True,
        user_joined=True,
        user_left=False,
        user_kicked=False"""
        if (event.user_joined
                or event.user_added) and not (await event.get_user()).bot:
            if CLEAN_WELCOME:
                try:
                    await event.client.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 event.client.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)
            my_mention = "[{}](tg://user?id={})".format(me.first_name, me.id)
            first = a_user.first_name
            last = a_user.last_name
            if last:
                fullname = f"{first} {last}"
            else:
                fullname = 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
            if my_last:
                my_fullname = f"{my_first} {my_last}"
            else:
                my_fullname = my_first
            my_username = f"@{me.username}" if me.username else my_mention
            file_media = None
            current_saved_welcome_message = None
            if cws and 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 and 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)
            update_previous_welcome(event.chat_id, current_message.id)
Ejemplo n.º 11
0
async def lydia_init():
    try:
        from sedenbot.moduller.sql_helper.lydia_sql import get_s, get_all_s, add_s, remove_s
    except:
        LOGS.warn("Lydia veritabanı bağlantısı başarısız oldu")