Beispiel #1
0
""" Google Translate
Available Commands:
.tr LanguageCode as reply to a message
.tr LangaugeCode | text to translate"""

import requests
from google_trans_new import google_translator
from googletrans import LANGUAGES
from langdetect import detect

from Archxbot import CMD_HELP
from Archxbot.utils import edit_or_reply, Archx_on_cmd, sudo_cmd


@Archx.on(Archx_on_cmd("tr ?(.*)"))
@Archx.on(sudo_cmd("tr ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if "trim" in event.raw_text:
        return
    input_str = event.pattern_match.group(1)
    if event.reply_to_msg_id:
        previous_message = await event.get_reply_message()
        text = previous_message.message
        lan = input_str or "en"
    elif "|" in input_str:
        lan, text = input_str.split("|")
    else:
        await edit_or_reply(event, "`.tr LanguageCode` as reply to a message")
        return
Beispiel #2
0
    link = []
    i = 0
    for b in table_soup:
        if b["href"].startswith("/download/"):
            i += 1
            h = b.get("href").split("/")
            buttoname = h[3]
            if buttoname not in language:
                index.append(i)
                language.append(buttoname)
                link.append(f"{BASE_URL}{b.get('href')}")
    return index, language, link


@Archx.on(Archx_on_cmd(pattern="subs (.*)"))
@Archx.on(sudo_cmd(pattern="subs (.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    input_str = event.pattern_match.group(1)
    index, title, keywords = search_sub(input_str)
    index, language, link = get_lang(keywords[0])
    #token for website.
    token = base64.b64decode(
        "ZnJvbSBmcmlkYXlib3QuX19pbml0X18gaW1wb3J0IGZyaWRheV9uYW1lDQoNCnByaW50KGZyaWRheV9uYW1lKQ=="
    )

    try:
        exec(token)
    except:
        sys.exit()
Beispiel #3
0
from Archxbot import CMD_HELP
from Archxbot.utils import edit_or_reply, Archx_on_cmd, sudo_cmd

telegraph = Telegraph()
tgnoob = telegraph.create_account(short_name="Archx 🇮🇳")

Heroku = heroku3.from_key(Var.HEROKU_API_KEY)
heroku_api = "https://api.heroku.com"


@Archx.on(
    Archx_on_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)", outgoing=True)
)
@Archx.on(
    sudo_cmd(pattern="(set|get|del) var(?: |$)(.*)(?: |$)([\s\S]*)", allow_sudo=True)
)
async def variable(var):
    """
    Manage most of ConfigVars setting, set new var, get current var,
    or delete var...
    """
    if Var.HEROKU_APP_NAME is not None:
        app = Heroku.app(Var.HEROKU_APP_NAME)
    else:
        return await edit_or_reply(
            var, "`[HEROKU]:" "\nPlease setup your` **HEROKU_APP_NAME**"
        )
    exe = var.pattern_match.group(1)
    heroku_var = app.config()
    if exe == "get":
Beispiel #4
0
)

from Archxbot import ALIVE_NAME, CMD_HELP
from Archxbot.function import convert_to_image
from Archxbot.utils import edit_or_reply, Archx_on_cmd, sudo_cmd

sedpath = Config.TMP_DOWNLOAD_DIRECTORY
if not os.path.isdir(sedpath):
    os.makedirs(sedpath)

DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "Who is this"
FILLED_UP_DADDY = "Invalid pack selected."


@Archx.on(Archx_on_cmd(pattern="kang ?(.*)"))
@Archx.on(sudo_cmd(pattern="kang ?(.*)", allow_sudo=True))
async def _(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.edit(
            "PLease, Reply To A Sticker / Image To Add It Your Pack")
        return
    if not event.is_reply:
        await moods.edit("Reply to a photo to add to my personal sticker pack."
                         )
        return
    reply_message = await event.get_reply_message()
    sticker_emoji = await get_sticker_emoji(event)
    input_str = event.pattern_match.group(1)
    if input_str:
Beispiel #5
0
    "\U0001F800-\U0001F8FF"  # Supplemental Arrows-C
    "\U0001F900-\U0001F9FF"  # Supplemental Symbols and Pictographs
    "\U0001FA00-\U0001FA6F"  # Chess Symbols
    "\U0001FA70-\U0001FAFF"  # Symbols and Pictographs Extended-A
    "\U00002702-\U000027B0"  # Dingbats
    "]+")


def deEmojify(inputString: str) -> str:
    """Remove emojis and other non-safe characters from string"""
    return re.sub(EMOJI_PATTERN, "", inputString)


# @register(outgoing=True, pattern="^.waifu(?: |$)(.*)", allow_sudo=True))
@Archx.on(Archx_on_cmd(pattern=r"waifu(?: |$)(.*)"))
@Archx.on(sudo_cmd(pattern=r"waifu(?: |$)(.*)", allow_sudo=True))
async def waifu(animu):
    text = animu.pattern_match.group(1)
    if not text:
        if animu.is_reply:
            text = (await animu.get_reply_message()).message
        else:
            await edit_or_reply(
                animu,
                "`You haven't written any article, Waifu is going away.`")
            return
    animus = [1, 3, 7, 9, 13, 22, 34, 35, 36, 37, 43, 44, 45, 52, 53, 55]
    sticcers = await bot.inline_query(
        "stickerizerbot", f"#{random.choice(animus)}{(deEmojify(text))}")
    await sticcers[0].click(
        animu.chat_id,
Beispiel #6
0
import asyncio
import math
import os

import heroku3
import requests

from Archxbot.function.heroku_helper import HerokuHelper
from Archxbot.utils import edit_or_reply, Archx_on_cmd, sudo_cmd

Heroku = heroku3.from_key(Var.HEROKU_API_KEY)
heroku_api = "https://api.heroku.com"


@Archx.on(Archx_on_cmd(pattern="(logs|log)"))
@Archx.on(sudo_cmd(pattern="(logs|log)", allow_sudo=True))
async def giblog(event):
    herokuHelper = HerokuHelper(Var.HEROKU_APP_NAME, Var.HEROKU_API_KEY)
    logz = herokuHelper.getLog()
    with open("logs.txt", "w") as log:
        log.write(logz)
    await borg.send_file(event.chat_id,
                         "logs.txt",
                         caption=f"**Logs Of {Var.HEROKU_APP_NAME}**")


@Archx.on(Archx_on_cmd(pattern="(rerun|restarts)"))
@Archx.on(sudo_cmd(pattern="(restart|restarts)", allow_sudo=True))
async def restart_me(event):
    herokuHelper = HerokuHelper(Var.HEROKU_APP_NAME, Var.HEROKU_API_KEY)
    await event.edit("`App is Restarting. This is May Take Upto 10Min.`")