Skip to content

Commit

Permalink
Release v0.0.6
Browse files Browse the repository at this point in the history
Co-authored-by: Aakash <[email protected]>
Co-authored-by: Aditya <[email protected]>
Co-authored-by: Danish <[email protected]>
Co-authored-by: buddhhu <[email protected]>
Co-authored-by: sppidy <[email protected]>
Co-authored-by: Arnab Paryali <[email protected]>
Co-authored-by: divkix <[email protected]>
Co-authored-by: hellboi_atul <[email protected]>
Co-authored-by: Programming Error <[email protected]>
Co-authored-by: New-dev0 <[email protected]>
  • Loading branch information
11 people committed May 8, 2021
1 parent adb2e3e commit 7eb5e58
Show file tree
Hide file tree
Showing 80 changed files with 4,876 additions and 966 deletions.
3 changes: 1 addition & 2 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
API_ID=
API_HASH=
SESSION=
BOT_USERNAME=
BOT_TOKEN=
REDIS_URI=
REDIS_PASSWORD=
LOG_CHANNEL=
LOG_CHANNEL=
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ addons/
ultroid.log
target/npmlist.json
node_modules
glitch_me/
glitch_me/
.idea
venv/
19 changes: 7 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.

FROM ultroidteam/ultroid:0.0.3
#RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
# dpkg -i ./google-chrome-stable_current_amd64.deb; apt -fqqy install && \
# rm ./google-chrome-stable_current_amd64.deb
#RUN wget -O chromedriver.zip http://chromedriver.storage.googleapis.com/$(curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip && \
# unzip chromedriver.zip chromedriver -d /usr/bin/ && \
# rm chromedriver.zip
RUN curl --silent --location https://deb.nodesource.com/setup_15.x | bash -
RUN apt-get install -y nodejs
FROM programmingerror/ultroid:v0.0.1

RUN git clone https://github.com/TeamUltroid/Ultroid.git /root/TeamUltroid/

RUN git clone https://github.com/1Danish-00/glitch_me.git && pip install -e ./glitch_me
WORKDIR /root/TeamUltroid/
RUN pip install -r requirements.txt
RUN rm -rf /usr/local/lib/python3.9/site-packages/.wh*
RUN npm install -g [email protected] && npm install

RUN pip3 install -r requirements.txt
RUN npm install -g [email protected] -g
RUN npm install
RUN npm run build
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
[![Open Source Love svg2](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/TeamUltroid/Ultroid)
[![Contributors](https://img.shields.io/github/contributors/TeamUltroid/Ultroid?style=flat-square&color=green)](https://github.com/TeamUltroid/Ultroid/graphs/contributors)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)
[![License](https://img.shields.io/badge/License-AGPL-blue)](https://github.com/TeamUltroid/Ultroid/blob/main/LICENSE)
[![HitCount](http://hits.dwyl.com/Teamultroid/Teamultroid/Ultroid.svg)](http://hits.dwyl.com/Teamultroid/Teamultroid/Ultroid)
[![License](https://img.shields.io/badge/License-AGPL-blue)](https://github.com/TeamUltroid/Ultroid/blob/main/LICENSE)
[![Sparkline](https://stars.medv.io/Teamultroid/Ultroid.svg)](https://stars.medv.io/TeamUltroid/Ultroid)

----
Expand Down Expand Up @@ -104,3 +103,4 @@ Ultroid is licensed under [GNU Affero General Public License](https://www.gnu.or
* [![TeamUltroid-Devs](https://img.shields.io/static/v1?label=Teamultroid&message=devs&color=critical)](https://t.me/UltroidDevs)
* [Lonami](https://github.com/LonamiWebs/) for [Telethon.](https://github.com/LonamiWebs/Telethon)
* [AndrewLaneX](https://github.com/AndrewLaneX) for [tgcalls.](http://github.com/tgcallsjs/tgcalls)

16 changes: 11 additions & 5 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
"description": "You api hash, from my.telegram.org or @ScrapperRoBot.",
"value": ""
},
"BOT_USERNAME": {
"description": "Make a bot from @BotFather, and enter it's username here, with '@'",
"value": ""
},
"BOT_TOKEN": {
"description": "Make a bot from @BotFather, and enter it's api token here.",
"value": ""
Expand Down Expand Up @@ -56,5 +52,15 @@
"description": "Create a private group. Add @missrose_bot and your BOT_USERNAME bot. Do /id. Paste that here",
"value": ""
}
},
"formation": {
"worker": {
"quantity": 1,
"size": "free"
},
"web": {
"quantity": 0,
"size": "free"
}
}
}
}
15 changes: 5 additions & 10 deletions assistant/inlinestuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
from bs4 import BeautifulSoup
from orangefoxapi import OrangeFoxAPI
from play_scraper import search
from rextester_py import rexec_aio
from rextester_py.rextester_aio import UnknownLanguage
from search_engine_parser import GoogleSearch, YahooSearch
from telethon import Button
from telethon.tl.types import InputWebDocument as wb
Expand All @@ -28,14 +26,6 @@
yeah = "https://telegra.ph/file/e3c67885e16a194937516.jpg"
ps = "https://telegra.ph/file/de0b8d9c858c62fae3b6e.jpg"
ultpic = "https://telegra.ph/file/4136aa1650bc9d4109cc5.jpg"
rex_langs = """ada, bash, brainfuck, c (clang), c, c (vc),
c#, c++ (clang), c++, c++ (vc++), d, elixir,
erlang, f#, fortran, go, haskell, java, js,
kotlin, lisp, lua, mysql, nasm, node,
objective-c, ocaml, octave, oracle, pascal,
perl, php, postgresql, prolog, python,
python3, r, ruby, scala, scheme, sql server,
swift, tcl, vb.net"""

ofox_api = OrangeFoxAPI()

Expand Down Expand Up @@ -156,6 +146,11 @@ async def repo(e):
text="• **ULTROID USERBOT** •",
buttons=[
[Button.url("Repo", url="https://github.com/TeamUltroid/Ultroid")],
[
Button.url(
"Addons", url="https://github.com/TeamUltroid/UltroidAddons"
)
],
[Button.url("Support", url="t.me/UltroidSupport")],
],
),
Expand Down
1 change: 1 addition & 0 deletions assistant/localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ async def settt(event):
udB.set("language", f"{lang}")
await event.edit(
f"Your language has been set to {languages[lang]['natively']} [{lang}].",
buttons=get_back_button("lang"),
)
120 changes: 115 additions & 5 deletions assistant/othervars.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.

import os
import re
from os import execl, remove

import requests
from telegraph import Telegraph
from telegraph import upload_file as upl

Expand All @@ -22,6 +24,109 @@
TOKEN_FILE = "resources/auths/auth_token.txt"


@callback("updatenow")
@owner
async def update(eve):
repo = Repo()
ac_br = repo.active_branch
ups_rem = repo.remote("upstream")
if Var.HEROKU_API:
import heroku3

heroku = heroku3.from_key(Var.HEROKU_API)
heroku_app = None
heroku_applications = heroku.apps()
for app in heroku_applications:
if app.name == Var.HEROKU_APP_NAME:
heroku_app = app
if heroku_app is None:
await eve.edit("`Invalid Heroku credentials for updating userbot dyno.`")
repo.__del__()
return
await eve.edit(
"`Userbot dyno build in progress, please wait for it to complete.`"
)
ups_rem.fetch(ac_br)
repo.git.reset("--hard", "FETCH_HEAD")
heroku_git_url = heroku_app.git_url.replace(
"https://", "https://api:" + Var.HEROKU_API + "@"
)
if "heroku" in repo.remotes:
remote = repo.remote("heroku")
remote.set_url(heroku_git_url)
else:
remote = repo.create_remote("heroku", heroku_git_url)
try:
remote.push(refspec=f"HEAD:refs/heads/{ac_br}", force=True)
except GitCommandError as error:
await eve.edit(f"`Here is the error log:\n{error}`")
repo.__del__()
return
await eve.edit("`Successfully Updated!\nRestarting, please wait...`")
else:
try:
ups_rem.pull(ac_br)
except GitCommandError:
repo.git.reset("--hard", "FETCH_HEAD")
await updateme_requirements()
await eve.edit(
"`Successfully Updated!\nBot is restarting... Wait for a second!`"
)
execl(sys.executable, sys.executable, "-m", "pyUltroid")


@callback("changes")
@owner
async def changes(okk):
repo = Repo.init()
ac_br = repo.active_branch
changelog, tl_chnglog = await gen_chlog(repo, f"HEAD..upstream/{ac_br}")
changelog_str = changelog + f"\n\nClick the below button to update!"
tldr_str = tl_chnglog + f"\n\nClick the below button to update!"
if len(changelog_str) > 1024:
await okk.edit(get_string("upd_4"))
file = open(f"ultroid_updates.txt", "w+")
file.write(tldr_str)
file.close()
await okk.edit(
get_string("upd_5"),
file="ultroid_updates.txt",
buttons=Button.inline("Update Now", data="updatenow"),
)
remove(f"ultroid_updates.txt")
return
else:
await okk.edit(
changelog_str,
buttons=Button.inline("Update Now", data="updatenow"),
parse_mode="html",
)


@callback(re.compile("pasta-(.*)"))
@owner
async def _(e):
ok = e.data_match.group(1)
hmm = open(ok)
hmmm = hmm.read()
hmm.close()
key = (
requests.post("https://nekobin.com/api/documents", json={"content": hmmm})
.json()
.get("result")
.get("key")
)
await e.edit(
f"Pasted to Nekobin\n 👉[Link](https://nekobin.com/{key})\n 👉[Raw Link](https://nekobin.com/raw/{key})",
buttons=Button.switch_inline(
"Search Again..?",
query="send ",
same_peer=True,
),
link_preview=False,
)


@callback("authorise")
@owner
async def _(e):
Expand Down Expand Up @@ -54,7 +159,7 @@ async def _(e):
+ "1. Open Google Drive App.\n"
+ "2. Create Folder.\n"
+ "3. Make that folder public.\n"
+ "4. Copy link of that folder."
+ "4. Copy link of that folder.\n"
+ "5. Send all characters which is after id= .",
)
async with ultroid_bot.asst.conversation(e.sender_id) as conv:
Expand Down Expand Up @@ -492,7 +597,7 @@ async def media(event):
try:
x = upl(media)
url = f"https://telegra.ph/{x[0]}"
os.remove(media)
remove(media)
except BaseException:
return await conv.send_message(
"Terminated.",
Expand Down Expand Up @@ -561,6 +666,11 @@ async def name(event):
buttons=get_back_button("pmcstm"),
)
else:
if len(themssg) > 4090:
return await conv.send_message(
"Message too long!\nGive a shorter message please!!",
buttons=get_back_button("pmcstm"),
)
await setit(event, var, themssg)
await conv.send_message(
"{} changed to {}\n\nAfter Setting All Things Do restart".format(
Expand Down Expand Up @@ -633,7 +743,7 @@ async def media(event):
try:
x = upl(media)
url = f"https://telegra.ph/{x[0]}"
os.remove(media)
remove(media)
except BaseException:
return await conv.send_message(
"Terminated.",
Expand Down Expand Up @@ -783,7 +893,7 @@ async def chbot(event):
buttons=[
[Button.inline("Cʜᴀᴛ Bᴏᴛ Oɴ", data="onchbot")],
[Button.inline("Cʜᴀᴛ Bᴏᴛ Oғғ", data="ofchbot")],
[Button.inline("Bᴏᴛ Wᴇʟᴄᴏɴᴇ", data="bwel")],
[Button.inline("Bᴏᴛ Wᴇʟᴄᴏᴍᴇ", data="bwel")],
[Button.inline("« Bᴀᴄᴋ", data="setter")],
],
link_preview=False,
Expand Down
2 changes: 1 addition & 1 deletion assistant/pmbot/incoming.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# if incoming


@asst.on(events.NewMessage(func=lambda e: e.is_private))
@asst.on(events.NewMessage(incoming=True, func=lambda e: e.is_private))
async def on_new_mssg(event):
incoming = event.raw_text
who = event.sender_id
Expand Down
2 changes: 1 addition & 1 deletion assistant/pmbot/outgoing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# outgoing


@asst.on(events.NewMessage(func=lambda e: e.is_private))
@asst.on(events.NewMessage(incoming=True, func=lambda e: e.is_private))
async def on_out_mssg(event):
x = await event.get_reply_message()
if x is None:
Expand Down
27 changes: 23 additions & 4 deletions assistant/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@

from . import *

Owner_info_msg = f"""
**Owner** - {OWNER_NAME}
**OwnerID** - `{OWNER_ID}`
**Message Forwards** - {udB.get("PMBOT")}
__Ultroid {ultroid_version}, powered by @TeamUltroid__
"""


@asst_cmd("start")
async def assistant(event):
Expand All @@ -31,23 +40,33 @@ async def assistant(event):
ok = ""
if event.is_private and event.sender_id in sed:
return
u = await event.client.get_entity(event.chat_id)
if not udB.get("STARTMSG"):
if udB.get("PMBOT") == "True":
ok = "You can contact my master using this bot!!\n\nSend your Message, I will Deliver it To Master."
await event.reply(
f"Hey there, this is Ultroid Assistant of {OWNER_NAME}!\n\n{ok}",
buttons=[Button.url("Know More", url="https://t.me/TeamUltroid")],
f"Hey there [{get_display_name(u)}](tg://user?id={u.id}), this is Ultroid Assistant of [{ultroid_bot.me.first_name}](tg://user?id={ultroid_bot.uid})!\n\n{ok}",
buttons=[Button.inline("Info.", data="ownerinfo")],
)
else:
u = await event.client.get_entity(event.chat_id)
me = f"[{ultroid_bot.me.first_name}](tg://user?id={ultroid_bot.uid})"
mention = f"[{get_display_name(u)}](tg://user?id={u.id})"
await event.reply(
Redis("STARTMSG").format(me=me, mention=mention),
buttons=[Button.url("Know More", url="https://t.me/TeamUltroid")],
buttons=[Button.inline("Info.", data="ownerinfo")],
)


@callback("ownerinfo")
async def own(event):
await event.edit(Owner_info_msg, buttons=[Button.inline("Close", data="closeit")])


@callback("closeit")
async def closet(lol):
await lol.delete()


@asst_cmd("start ?(.*)")
@owner
async def ultroid(event):
Expand Down
4 changes: 2 additions & 2 deletions assistant/ytdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async def _(sur):
if sur.is_private and sur.sender_id != ultroid_bot.uid:
chat = sur.sender_id
whome = asst
MSG += f"\nGet at {Var.BOT_USERNAME}"
MSG += f"\nGet at {asst.me.username}"
try:
await whome.send_file(
chat,
Expand Down Expand Up @@ -217,7 +217,7 @@ async def _(fuk):
if event.is_private and event.sender_id != ultroid_bot.uid:
chat = fuk.sender_id
whome = asst
MSG += f"\nGet at {Var.BOT_USERNAME}"
MSG += f"\nGet at {asst.me.username}"
try:
await whome.send_file(
chat,
Expand Down
2 changes: 0 additions & 2 deletions commit

This file was deleted.

Loading

0 comments on commit 7eb5e58

Please sign in to comment.