Skip to content

Commit

Permalink
[Update] Ultroid v0.6
Browse files Browse the repository at this point in the history
Co-Authored-By: Amit Sharma <[email protected]>
Co-Authored-By: MMETMA <[email protected]>
Co-Authored-By: Aditya <[email protected]>
Co-Authored-By: marat2509 <[email protected]>
Co-Authored-By: smartman_ru <[email protected]>
Co-Authored-By: Flasho <[email protected]>
Co-Authored-By: ÁÑÑÍHÌLÅTØR SPÄRK <[email protected]>
  • Loading branch information
8 people committed Jun 6, 2022
1 parent d408591 commit 4d30dd7
Show file tree
Hide file tree
Showing 41 changed files with 1,062 additions and 1,153 deletions.
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ FROM theteamultroid/ultroid:main

# set timezone
ENV TZ=Asia/Kolkata
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
# cloning the repo and installing requirements.
&& git clone https://github.com/TeamUltroid/Ultroid.git /root/TeamUltroid/ \
&& pip3 install --no-cache-dir -r root/TeamUltroid/requirements.txt \
&& pip3 install av --no-binary av

# Railway's banned dependency
RUN if [ ! $RAILWAY_STATIC_URL ]; then pip3 install --no-cache-dir yt-dlp; fi
RUN bash installer.sh

# changing workdir
WORKDIR /root/TeamUltroid/
WORKDIR "/root/TeamUltroid"

# start the bot
# start the bot.
CMD ["bash", "startup"]
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

<b>A stable pluggable Telegram userbot + Voice & Video Call music bot, based on Telethon.</b>

[![](https://img.shields.io/badge/Ultroid-v0.5-blue)](#)
[![](https://img.shields.io/badge/Ultroid-v0.6-darkblue)](#)
[![Stars](https://img.shields.io/github/stars/TeamUltroid/Ultroid?style=flat-square&color=yellow)](https://github.com/TeamUltroid/Ultroid/stargazers)
[![Forks](https://img.shields.io/github/forks/TeamUltroid/Ultroid?style=flat-square&color=orange)](https://github.com/TeamUltroid/Ultroid/fork)
[![Size](https://img.shields.io/github/repo-size/TeamUltroid/Ultroid?style=flat-square&color=green)](https://github.com/TeamUltroid/Ultroid/)
[![Python](https://img.shields.io/badge/Python-v3.10.2-blue)](https://www.python.org/)
[![Python](https://img.shields.io/badge/Python-v3.10.3-blue)](https://www.python.org/)
[![CodeFactor](https://www.codefactor.io/repository/github/teamultroid/ultroid/badge/main)](https://www.codefactor.io/repository/github/teamultroid/ultroid/overview/main)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/TeamUltroid/Ultroid/graphs/commit-activity)
[![Docker Pulls](https://img.shields.io/docker/pulls/theteamultroid/ultroid?style=flat-square)](https://img.shields.io/docker/pulls/theteamultroid/ultroid?style=flat-square)
Expand All @@ -23,8 +23,9 @@
----

# Deploy
- [Heroku](#Deploy-to-Heroku)
- [Local Machine](#Deploy-Locally)
- [Heroku](#deploy-to-heroku)
- [Okteto](#deploy-to-okteto)
- [Local Machine](#deploy-locally)

# Documentation
[![Documentation](https://img.shields.io/badge/Documentation-Ultroid-blue)](http://ultroid.tech/)
Expand All @@ -40,10 +41,15 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://deploy.ultroid.tech)

## Deploy to Okteto
Get the [Necessary Variables](#Necessary-Variables) and then click the button below!

[![Develop on Okteto](https://okteto.com/develop-okteto.svg)](https://cloud.okteto.com/deploy?repository=https://github.com/TeamUltroid/Ultroid)

## Deploy Locally
- [Traditional Method](#local-deploy---traditional-method)
- [Easy Method](#local-deploy---easy-method)
- [Ultroid CLI](#Ultroid-CLI)
- [Ultroid CLI](#ultroid-cli)

### Local Deploy - Easy Method
- Linux - `wget -O locals.py https://git.io/JY9UM && python3 locals.py`
Expand Down
10 changes: 5 additions & 5 deletions assistant/callbackstuffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from pyUltroid.functions.gDrive import GDriveManager
except ImportError:
GDriveManager = None
from pyUltroid.functions.helper import fast_download, progress, uploader
from pyUltroid.functions.helper import fast_download, progress
from pyUltroid.functions.tools import (
Carbon,
async_searcher,
Expand Down Expand Up @@ -1284,8 +1284,10 @@ async def fdroid_dler(event):
)
),
)
tt = time.time()
n_file = await uploader(file, file, tt, event, "Uploading...")
time.time()
n_file = await event.client.fast_uploader(
file, show_progress=True, event=event, message="Uploading...", to_delete=True
)
buttons = Button.switch_inline("Search Back", query="fdroid", same_peer=True)
try:
msg = await event.edit(
Expand All @@ -1304,10 +1306,8 @@ async def fdroid_dler(event):
)
except Exception as er:
os.remove(thumb)
os.remove(file)
LOGS.exception(er)
return await event.edit(f"**ERROR**: `{er}`", buttons=buttons)
if msg and hasattr(msg, "media"):
FD_MEDIA.update({uri: msg.media})
os.remove(thumb)
os.remove(file)
6 changes: 3 additions & 3 deletions assistant/inlinestuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ async def repo(e):
@in_pattern("go", owner=True)
async def gsearch(q_event):
try:
match = q_event.text.split(" ", maxsplit=1)[1]
match = q_event.text.split(maxsplit=1)[1]
except IndexError:
return await q_event.answer(
[], switch_pm="Google Search. Enter a query!", switch_pm_param="start"
Expand Down Expand Up @@ -273,7 +273,7 @@ async def _(e):

@in_pattern("xda", owner=True)
async def xda_dev(event):
QUERY = event.text.split(" ", maxsplit=1)
QUERY = event.text.split(maxsplit=1)
try:
query = QUERY[1]
except IndexError:
Expand Down Expand Up @@ -749,7 +749,7 @@ async def inline_tl(ult):
try:
match = ult.text.split(maxsplit=1)[1]
except IndexError:
text = f"**It is Telegram TlObjects Searcher.**\n__(Don't use if you don't know what it is!)__\n\n• Example Usage\n`@{asst.me.username} tl GetUserRequest`"
text = f"**Telegram TlObjects Searcher.**\n__(Don't use if you don't know what it is!)__\n\n• Example Usage\n`@{asst.me.username} tl GetFullUserRequest`"
return await ult.answer(
[
await ult.builder.article(
Expand Down
3 changes: 3 additions & 0 deletions assistant/manager/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import aiohttp
from pyUltroid.dB import DEVLIST
from pyUltroid.functions.admins import admin_check

from . import *

Expand All @@ -24,6 +25,8 @@ async def dheh(e):

@asst_cmd(pattern="echo( (.*)|$)")
async def oqha(e):
if not await admin_check(e):
return
match = e.pattern_match.group(1).strip()
if match:
text = match
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ services:
API_ID: $API_ID # defaults to None
API_HASH: $API_HASH # defaults to None
MONGO_URI: $MONGO_URI # defaults to None
BOT_TOKEN: $BOT_TOKEN # Not mandatory
LOG_CHANNEL: $LOG_CHANNEL # Not mandatory
DATABASE_URL: $DATABASE_URL # defaults to None
OKTETO_TOKEN: $OKTETO_TOKEN
54 changes: 54 additions & 0 deletions installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

REPO="https://github.com/TeamUltroid/Ultroid.git"
DIR="/root/TeamUltroid"

spinner(){
local pid=$!
while [ "$(ps a | awk '{print $1}' | grep $pid)" ];
do
for i in "Ooooo" "oOooo" "ooOoo" "oooOo" "ooooO" "oooOo" "ooOoo" "oOooo" "Ooooo"
do
echo -ne "\r• $i"
sleep 0.2
done
done
}

clone_repo(){
if [ ! $BRANCH ]
then export BRANCH="main"
fi
echo -e "\n\nCloning Ultroid ${BRANCH}... "
git clone -b $BRANCH $REPO $DIR
}

install_requirements(){
echo -e "\n\nInstalling requirements... "
pip3 install -q --no-cache-dir -r $DIR/requirements.txt && pip3 install av -q --no-binary av
}

railways_dep(){
if [ ! $RAILWAY_STATIC_URL ]
then
echo -e "\n\nInstalling YouTube dependency... "
pip3 install -q --no-cache-dir yt-dlp
fi
}

install_okteto_cli(){
if [ $OKTETO_TOKEN ]
then
echo -e "\n\nInstalling Okteto-CLI... "
curl https://get.okteto.com -sSfL | sh
fi
}

main(){
(clone_repo) & spinner
(install_requirements) & spinner
(railways_dep) & spinner
(install_okteto_cli) & spinner
}

main
3 changes: 3 additions & 0 deletions okteto-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
icon: https://raw.githubusercontent.com/TeamUltroid/Ultroid/main/resources/extras/logo_readme.jpg
deploy:
- okteto stack deploy --build -f docker-compose.yml
1 change: 0 additions & 1 deletion plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.


import asyncio
import os
import time
Expand Down
105 changes: 35 additions & 70 deletions plugins/_inline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,17 @@
from telethon.tl.types import InputWebDocument, Message
from telethon.utils import resolve_bot_file_id

from . import HNDLR, INLINE_PIC, LOGS, OWNER_NAME, asst, get_string, start_time, udB
from . import (
HNDLR,
INLINE_PIC,
LOGS,
OWNER_NAME,
asst,
get_string,
split_list,
start_time,
udB,
)
from ._help import _main_help_menu

# ================================================#
Expand Down Expand Up @@ -270,83 +280,38 @@ async def _(event):
await event.answer(pin, cache_time=0, alert=True)


InPlugin = {
"Pʟᴀʏ Sᴛᴏʀᴇ Aᴘᴘs": "app telegram",
"Mᴏᴅᴅᴇᴅ Aᴘᴘs": "mods minecraft",
"Sᴇᴀʀᴄʜ Oɴ Gᴏᴏɢʟᴇ": "go TeamUltroid",
"Search on XDA": "xda telegram",
"WʜɪSᴘᴇʀ": "wspr @username Hello🎉",
"YᴏᴜTᴜʙᴇ Dᴏᴡɴʟᴏᴀᴅᴇʀ": "yt Ed Sheeran Perfect",
"Piston Eval": "run javascript console.log('Hello Ultroid')",
"OʀᴀɴɢᴇFᴏx🦊": "ofox beryllium",
"Tᴡɪᴛᴛᴇʀ Usᴇʀ": "twitter theultroid",
"Kᴏᴏ Sᴇᴀʀᴄʜ": "koo @__kumar__amit",
"Fᴅʀᴏɪᴅ Sᴇᴀʀᴄʜ": "fdroid telegram",
"Sᴀᴀᴠɴ sᴇᴀʀᴄʜ": "saavn",
"Tʟ Sᴇᴀʀᴄʜ": "tl",
"GɪᴛHᴜʙ ғᴇᴇᴅs": "gh",
"OᴍɢUʙᴜɴᴛᴜ": "omgu cutefish",
}
_InButtons = [Button.switch_inline(_, query=InPlugin[_]) for _ in list(InPlugin.keys())]
InButtons = split_list(_InButtons, 2)


@callback(data="inlone", owner=True)
async def _(e):
button = [
[
Button.switch_inline(
"Pʟᴀʏ Sᴛᴏʀᴇ Aᴘᴘs",
query="app telegram",
same_peer=True,
),
Button.switch_inline(
"Mᴏᴅᴅᴇᴅ Aᴘᴘs",
query="mods minecraft",
same_peer=True,
),
],
[
Button.switch_inline(
"Sᴇᴀʀᴄʜ Oɴ Gᴏᴏɢʟᴇ",
query="go TeamUltroid",
same_peer=True,
),
Button.switch_inline(
"Search on XDA",
query="xda telegram",
same_peer=True,
),
],
[
Button.switch_inline(
"WʜɪSᴘᴇʀ",
query="wspr @username Hello🎉",
same_peer=True,
),
Button.switch_inline(
"YᴏᴜTᴜʙᴇ Dᴏᴡɴʟᴏᴀᴅᴇʀ",
query="yt Ed Sheeran Perfect",
same_peer=True,
),
],
[
Button.switch_inline(
"Piston Eval",
query="run javascript console.log('Hello Ultroid')",
same_peer=True,
),
Button.switch_inline(
"OʀᴀɴɢᴇFᴏx🦊",
query="ofox beryllium",
same_peer=True,
),
],
[
Button.switch_inline(
"Tᴡɪᴛᴛᴇʀ Usᴇʀ", query="twitter theultroid", same_peer=True
),
Button.switch_inline(
"Kᴏᴏ Sᴇᴀʀᴄʜ", query="koo @__kumar__amit", same_peer=True
),
],
[
Button.switch_inline(
"Fᴅʀᴏɪᴅ Sᴇᴀʀᴄʜ", query="fdroid telegram", same_peer=True
),
Button.switch_inline("Sᴀᴀᴠɴ sᴇᴀʀᴄʜ", query="saavn", same_peer=True),
],
[
Button.switch_inline("Tʟ Sᴇᴀʀᴄʜ", query="tl", same_peer=True),
Button.switch_inline("GɪᴛHᴜʙ ғᴇᴇᴅs", query="gh", same_peer=True),
],
[Button.switch_inline("OᴍɢUʙᴜɴᴛᴜ", query="omgu cutefish", same_peer=True)],
button = InButtons.copy()
button.append(
[
Button.inline(
"« Bᴀᴄᴋ",
data="open",
),
],
]
)
await e.edit(buttons=button, link_preview=False)


Expand Down
10 changes: 5 additions & 5 deletions plugins/_wspr.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ async def _(e):
okk = await e.get_reply_message()
if okk.sender.username:
put = f"@{okk.sender.username}"
put = okk.sender_id
else:
put = okk.sender_id
else:
put = e.pattern_match.group(1).strip()
if put:
Expand Down Expand Up @@ -72,7 +73,8 @@ async def _(e):
text="You Didn't Type Username or id.",
)
return await e.answer([sur])
except ValueError:
except ValueError as er:
LOGS.exception(er)
sur = e.builder.article(
title="User Not Found",
description="Make sure username or id is correct.",
Expand Down Expand Up @@ -141,11 +143,9 @@ async def _(e):
same_peer=True,
),
]
sur = e.builder.document(
sur = e.builder.article(
title=user.first_name,
description=desc,
file=logi.full_user.profile_photo,
include_media=False,
text=text,
buttons=button,
)
Expand Down
Loading

0 comments on commit 4d30dd7

Please sign in to comment.