Beispiel #1
0
# C O D E A Z \ Samil

import io
import os
import requests
from userbot.events import register
from telethon.tl.types import MessageMediaPhoto
from userbot import CMD_HELP, REM_BG_API_KEY, TEMP_DOWNLOAD_DIRECTORY
from userbot.cmdhelp import CmdHelp
from userbot.cmdtr import CmdTr

# ██████ LANGUAGE CONSTANTS ██████ #

from userbot.language import get_value
LANG = get_value("remove_bg")

# ████████████████████████████████ #

@register(outgoing=True, pattern="^.rbg(?: |$)(.*)")
async def kbg(remob):
    """ .rbg """
    if REM_BG_API_KEY is None:
        await remob.edit(
            LANG['NEED_API_KEY']
        )
        return
    input_str = remob.pattern_match.group(1)
    message_id = remob.message.id
    if remob.reply_to_msg_id:
        message_id = remob.reply_to_msg_id
        reply_message = await remob.get_reply_message()
Beispiel #2
0
from telethon.errors import AboutTooLongError
from telethon.tl.functions.account import UpdateProfileRequest
from telethon.tl.functions.users import GetFullUserRequest
from telethon.errors.rpcerrorlist import FloodWaitError

from userbot import CMD_HELP, BOTLOG, BOTLOG_CHATID, DEFAULT_BIO, BIO_PREFIX, lastfm, LASTFM_USERNAME, bot
from userbot.events import register
from userbot.cmdhelp import CmdHelp
from userbot.cmdtr import CmdTr

# =================== CONSTANT ===================
# ██████ LANGUAGE CONSTANTS ██████ #

from userbot.language import get_value
LANG = get_value("lastfm")

# ████████████████████████████████ #

LFM_BIO_ENABLED = LANG['BIO_ENABLED']
LFM_BIO_DISABLED = LANG['BIO_DISABLED']
LFM_BIO_RUNNING = LANG['BIO_RUNNING']
LFM_BIO_ERR = LANG['BIO_ERR']
LFM_LOG_ENABLED = LANG['LOG_ENABLED']
LFM_LOG_DISABLED = LANG['LOG_DISABLED']
LFM_LOG_ERR = LANG['LOG_ERR']
ERROR_MSG = LANG['ERROR_MSG']

ARTIST = 0
SONG = 0
USER_ID = 0
Beispiel #3
0
import datetime
import asyncio
from telethon import events
from telethon.errors.rpcerrorlist import YouBlockedUserError
from telethon.tl.functions.account import UpdateNotifySettingsRequest
from userbot import bot, CMD_HELP
from userbot.events import register
import os
import subprocess
import glob
from random import randint
from userbot.cmdhelp import CmdHelp

from userbot.language import get_value

LANG = get_value("song")


@register(outgoing=True, pattern="^.deez(\d*|)(?: |$)(.*)")
async def deezl(event):
    if event.fwd_from:
        return
    sira = event.pattern_match.group(1)
    if sira == '':
        sira = 0
    else:
        sira = int(sira)

    sarki = event.pattern_match.group(2)
    if len(sarki) < 1:
        if event.is_reply:
Beispiel #4
0
from userbot import CMD_HELP, bot, PAKET_ISMI
from userbot.events import register
from userbot.main import PLUGIN_MESAJLAR
from telethon import events
from userbot.cmdhelp import CmdHelp

PACK_FULL = "Whoa! That's probably enough stickers for one pack, give it a break. \
A pack can't have more than 120 stickers at the moment."

PACK_DOESNT_EXIST = "  A <strong>Telegram</strong> user has created the <strong>Sticker&nbsp;Set</strong>."

# ██████ LANGUAGE CONSTANTS ██████ #

from userbot.language import get_value

LANG = get_value("stickers")

# ████████████████████████████████ #


@register(outgoing=True, pattern="^.fırlat($| )?((?![0-9]).+?)? ?([0-9]*)?")
async def kang(event):
    await event.edit(f"`{PLUGIN_MESAJLAR['dızcı']}`")
    user = await bot.get_me()
    pack_username = ''
    if not user.username:
        try:
            user.first_name.decode('ascii')
            pack_username = user.first_name
        except UnicodeDecodeError:  # User's first name isn't ASCII, use ID instead
            pack_username = user.id
Beispiel #5
0
from telethon.tl.functions.messages import ReportSpamRequest
from telethon.tl.types import User
from sqlalchemy.exc import IntegrityError

from userbot import (COUNT_PM, CMD_HELP, BOTLOG, BOTLOG_CHATID, PM_AUTO_BAN,
                     PM_AUTO_BAN_LIMIT, LASTMSG, LOGS, BRAIN_CHECKER,
                     WHITELIST)
from userbot.events import register
from userbot.main import PLUGIN_MESAJLAR
from userbot.cmdhelp import CmdHelp
from userbot.cmdtr import CmdTr

# ██████ LANGUAGE CONSTANTS ██████ #

from userbot.language import get_value
LANG = get_value("pmpermit")

# ████████████████████████████████ #


@register(incoming=True, disable_edited=True, disable_errors=True)
async def permitpm(event):
    """ PM """
    if PM_AUTO_BAN:
        self_user = await event.client.get_me()
        if event.is_private and event.chat_id != 777000 and event.chat_id != self_user.id and not (
                await event.get_sender()).bot:
            try:
                from userbot.modules.sql_helper.pm_permit_sql import is_approved
                from userbot.modules.sql_helper.globals import gvarstatus
            except AttributeError:
Beispiel #6
0
import sys

from git import Repo
from git.exc import GitCommandError, InvalidGitRepositoryError, NoSuchPathError

from userbot import CMD_HELP, HEROKU_APIKEY, HEROKU_APPNAME, UPSTREAM_REPO_URL
from userbot.events import register
from userbot.cmdhelp import CmdHelp

requirements_path = path.join(
    path.dirname(path.dirname(path.dirname(__file__))), 'requirements.txt')

# ██████ LANGUAGE CONSTANTS ██████ #

from userbot.language import get_value
LANG = get_value("updater")

# ████████████████████████████████ #


async def gen_chlog(repo, diff):
    ch_log = ''
    d_form = "%d/%m/%y"
    for c in repo.iter_commits(diff):
        ch_log += f'•[{c.committed_datetime.strftime(d_form)}]: {c.summary} <{c.author}>\n'
    return ch_log


async def update_requirements():
    reqs = str(requirements_path)
    try:
Beispiel #7
0
from userbot import LYDIA_API_KEY
import coffeehouse as cf
from coffeehouse.lydia import LydiaAI
from coffeehouse.api import API
import asyncio
import logging
from userbot.cmdhelp import CmdHelp

logging.basicConfig(
    format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
    level=logging.WARNING)

# ██████ LANGUAGE CONSTANTS ██████ #

from userbot.language import get_value
LANG = get_value("lydia")

# ████████████████████████████████ #

try:
    from userbot.modules.sql_helper.lydia_sql import get_s, get_all_s, add_s, remove_s
except:
    logging.log(level=logging.WARNING,
                msg="Lydia verilənlər bazası bağlantısı alınmadı")

ACC_LYDIA = {}

if LYDIA_API_KEY:
    api_key = LYDIA_API_KEY
    api_client = API(api_key)
    lydia = LydiaAI(api_client)
import os
from telethon.tl.functions.contacts import UnblockRequest
from telethon.errors.rpcerrorlist import YouBlockedUserError
from userbot.events import register
from userbot.cmdhelp import CmdHelp

# ██████ LANGUAGE CONSTANTS ██████ #

from userbot.language import get_value
LANG = get_value("botfather")

# ████████████████████████████████ #

chat = "@BotFather"


@register(outgoing=True, pattern="^.newbot ?(.*)")
async def _(event):
    if event.fwd_from:
        return
    if event.pattern_match.group(1):
        text, username = event.pattern_match.group(1).split()

    else:
        await event.edit(LANG["ERROR"])
        return

    async with event.client.conversation(chat) as conv:
        try:
            await conv.send_message("/newbot")
            audio = await conv.get_response()
Beispiel #9
0
# C O D E A Z \ Samil
""" Notes """

from userbot import BOTLOG, BOTLOG_CHATID, CMD_HELP
from userbot.events import register
from asyncio import sleep
from userbot.cmdhelp import CmdHelp
from userbot.cmdtr import CmdTr

# ██████ LANGUAGE CONSTANTS ██████ #

from userbot.language import get_value

LANG = get_value("notes")

# ████████████████████████████████ #


@register(outgoing=True, pattern="^.notes$")
async def notes_active(svd):
    """ .notes """
    try:
        from userbot.modules.sql_helper.notes_sql import get_notes
    except AttributeError:
        await svd.edit("`Bot Non-SQL modunda işləyir!!`")
        return
    message = LANG['NOT_FOUND']
    notes = get_notes(svd.chat_id)
    for note in notes:
        if message == LANG['NOT_FOUND']:
            message = f"{LANG['NOTES']}:\n"