fix: eval on python 3.13 and include multi client script
This commit is contained in:
32
README.md
32
README.md
@@ -113,12 +113,42 @@ Different ways to get your `SESSION`:
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# Core Contributor Team
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><a href="https://github.com/xditya"><img src="https://avatars.githubusercontent.com/xditya" width="75px;" alt=""/><br/><sub><b>@xditya</b></sub></a></td>
|
||||||
|
<td align="center"><a href="https://github.com/1danish-00"><img src="https://avatars.githubusercontent.com/1danish-00" width="75px;" alt=""/><br/><sub><b>@1danish_00</b></sub></a></td>
|
||||||
|
<td align="center"><a href="https://github.com/buddhhu"><img src="https://avatars.githubusercontent.com/buddhhu" width="75px;" alt=""/><br/><sub><b>@buddhhu</b></sub></a></td>
|
||||||
|
<td align="center"><a href="https://github.com/TechiError"><img src="https://avatars.githubusercontent.com/TechiError" width="75px;" alt=""/><br/><sub><b>@TechiError</b></sub></a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><a href="https://github.com/New-dev0"><img src="https://avatars.githubusercontent.com/New-dev0" width="75px;" alt=""/><br/><sub><b>@New-dev0</b></sub></a></td>
|
||||||
|
<td align="center"><a href="https://github.com/ArnabXD"><img src="https://avatars.githubusercontent.com/ArnabXD" width="75px;" alt=""/><br/><sub><b>@Arnab431</b></sub></a></td>
|
||||||
|
<td align="center"><a href="https://github.com/sppidy"><img src="https://avatars.githubusercontent.com/sppidy" width="75px;" alt=""/><br/><sub><b>@sppidy</b></sub></a></td>
|
||||||
|
<td align="center"><a href="https://github.com/Atul-Kumar-Jena"><img src="https://avatars.githubusercontent.com/Atul-kumar-Jena" width="75px;" alt=""/><br/><sub><b>@hellboi_atul</b></sub></a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td align="center"><a href="https://github.com/iAkashPattnaik"><img src="https://avatars.githubusercontent.com/iAkashPattnaik" width="75px;" alt=""/><br/><sub><b>@iAkashPattnaik</b></sub></a></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
<a href="https://github.com/TeamUltroid/Ultroid/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=TeamUltroid/Ultroid" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
We are highly grateful for all the contributions made by our amazing community! ❤️
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
# License
|
# License
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
Ultroid is licensed under [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html) v3 or later.
|
Ultroid is licensed under [GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html) v3 or later.
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
---
|
||||||
# Credits
|
# Credits
|
||||||
* [](https://t.me/UltroidDevs)
|
* [](https://t.me/UltroidDevs)
|
||||||
* [Lonami](https://github.com/LonamiWebs/) for [Telethon.](https://github.com/LonamiWebs/Telethon)
|
* [Lonami](https://github.com/LonamiWebs/) for [Telethon.](https://github.com/LonamiWebs/Telethon)
|
||||||
|
|||||||
39
multi_client.py
Normal file
39
multi_client.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import asyncio
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
vars = ["API_ID", "API_HASH", "SESSION"]
|
||||||
|
|
||||||
|
def _check(z):
|
||||||
|
new = []
|
||||||
|
for var in vars:
|
||||||
|
ent = os.environ.get(var + z)
|
||||||
|
if not ent:
|
||||||
|
return False, new
|
||||||
|
new.append(ent)
|
||||||
|
return True, new
|
||||||
|
|
||||||
|
for z in range(5):
|
||||||
|
n = str(z + 1)
|
||||||
|
if z == 0:
|
||||||
|
z = ""
|
||||||
|
fine, out = _check(str(z))
|
||||||
|
if fine:
|
||||||
|
subprocess.Popen(
|
||||||
|
[sys.executable, "-m", "pyUltroid", out[0], out[1], out[2], out[3], out[4], n],
|
||||||
|
stdin=None,
|
||||||
|
stderr=None,
|
||||||
|
stdout=None,
|
||||||
|
cwd=None,
|
||||||
|
)
|
||||||
|
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
try:
|
||||||
|
loop.run_forever()
|
||||||
|
except Exception as er:
|
||||||
|
print(er)
|
||||||
|
finally:
|
||||||
|
loop.close()
|
||||||
|
|
||||||
@@ -321,19 +321,34 @@ def _stringify(text=None, *args, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
async def aexec(code, event):
|
async def aexec(code, event):
|
||||||
exec(
|
# Create a dedicated namespace for execution
|
||||||
(
|
exec_globals = {
|
||||||
"async def __aexec(e, client): "
|
'print': _stringify,
|
||||||
+ "\n print = p = _stringify"
|
'p': _stringify,
|
||||||
+ "\n message = event = e"
|
'message': event,
|
||||||
+ "\n u.r = reply = await event.get_reply_message()"
|
'event': event,
|
||||||
+ "\n chat = event.chat_id"
|
'client': event.client,
|
||||||
+ "\n u.lr = locals()"
|
'reply': await event.get_reply_message(),
|
||||||
)
|
'chat': event.chat_id,
|
||||||
+ "".join(f"\n {l}" for l in code.split("\n"))
|
'u': u,
|
||||||
|
'__builtins__': __builtins__
|
||||||
|
}
|
||||||
|
|
||||||
|
# Format the async function definition
|
||||||
|
wrapped_code = (
|
||||||
|
'async def __aexec(e, client):\n' +
|
||||||
|
'\n'.join(f' {line}' for line in code.split('\n'))
|
||||||
)
|
)
|
||||||
|
|
||||||
return await locals()["__aexec"](event, event.client)
|
try:
|
||||||
|
# Execute the wrapped code in our custom namespace
|
||||||
|
exec(wrapped_code, exec_globals)
|
||||||
|
# Get the defined async function
|
||||||
|
func = exec_globals['__aexec']
|
||||||
|
# Execute it with proper parameters
|
||||||
|
return await func(event, event.client)
|
||||||
|
except Exception as e:
|
||||||
|
raise Exception(f"Failed to execute code: {str(e)}")
|
||||||
|
|
||||||
|
|
||||||
DUMMY_CPP = """#include <iostream>
|
DUMMY_CPP = """#include <iostream>
|
||||||
|
|||||||
2
startup
2
startup
@@ -16,4 +16,4 @@ echo "
|
|||||||
|
|
||||||
"
|
"
|
||||||
if [ -f .env ] ; then set -o allexport; source .env; set +o allexport ; fi
|
if [ -f .env ] ; then set -o allexport; source .env; set +o allexport ; fi
|
||||||
if [ $SESSION1 ] ; then wget https://gist.github.com/1Danish-00/6554f034549197e5824972b01f631e0c/raw/main.py && python3 main.py ; else python3 -m pyUltroid ; fi
|
if [ $SESSION1 ] ; then python3 multi_client.py ; else python3 -m pyUltroid ; fi
|
||||||
|
|||||||
Reference in New Issue
Block a user