Co-Authored-By: Aditya <me@xditya.me> Co-Authored-By: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-Authored-By: hellboi_atul <68107352+hellboi-atul@users.noreply.github.com> Co-Authored-By: Sρι∂у <68327188+sppidy@users.noreply.github.com> Co-Authored-By: Anonymous <69723581+New-dev0@users.noreply.github.com> Co-Authored-By: Danish <72792730+1Danish-00@users.noreply.github.com> Co-Authored-By: Arnab Paryali <arnabxd@pm.me> Co-Authored-By: Programming Error <75001577+programmingerror@users.noreply.github.com>
95 lines
3.0 KiB
Python
95 lines
3.0 KiB
Python
# Ultroid - UserBot
|
|
# Copyright (C) 2020 TeamUltroid
|
|
#
|
|
# 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/>.
|
|
|
|
import os
|
|
|
|
from telegraph import Telegraph, upload_file
|
|
|
|
from . import *
|
|
|
|
# --------------------------------------------------------------------#
|
|
telegraph = Telegraph()
|
|
r = telegraph.create_account(short_name="Ultroid")
|
|
auth_url = r["auth_url"]
|
|
# --------------------------------------------------------------------#
|
|
|
|
|
|
@callback("alvcstm")
|
|
@owner
|
|
async def alvcs(event):
|
|
await event.edit(
|
|
"Customise your {}alive. Choose from the below options -".format(Var.HNDLR),
|
|
buttons=[
|
|
[Button.inline("Alive Text", data="alvtx")],
|
|
[Button.inline("Alive Media", data="alvmed")],
|
|
[Button.inline("Delete Alive Media", data="delmed")],
|
|
],
|
|
)
|
|
|
|
|
|
@callback("alvtx")
|
|
@owner
|
|
async def name(event):
|
|
await event.delete()
|
|
pru = event.sender_id
|
|
var = "ALIVE_TEXT"
|
|
name = "Alive Text"
|
|
async with event.client.conversation(pru) as conv:
|
|
await conv.send_message(
|
|
"**Alive Text**\nEnter the new alive text.\n\nUse /cancel to terminate the operation."
|
|
)
|
|
response = conv.wait_event(events.NewMessage(chats=pru))
|
|
response = await response
|
|
themssg = response.message.message
|
|
if themssg == "/cancel":
|
|
return await conv.send_message("Cancelled!!")
|
|
else:
|
|
await setit(event, var, themssg)
|
|
await conv.send_message("{} changed to {}".format(name, themssg))
|
|
|
|
|
|
@callback("alvmed")
|
|
@owner
|
|
async def media(event):
|
|
await event.delete()
|
|
pru = event.sender_id
|
|
var = "ALIVE_PIC"
|
|
name = "Alive Media"
|
|
async with event.client.conversation(pru) as conv:
|
|
await conv.send_message(
|
|
"**Alive Media**\nSend me a pic/gif/bot api id of sticker to set as alive media.\n\nUse /cancel to terminate the operation."
|
|
)
|
|
response = await conv.get_response()
|
|
try:
|
|
themssg = response.message.message
|
|
if themssg == "/cancel":
|
|
return await conv.send_message("Operation cancelled!!")
|
|
except BaseException:
|
|
pass
|
|
media = await event.client.download_media(response, "alvpc")
|
|
if not (response.text).startswith("/") and not response.text == "":
|
|
url = response.text
|
|
else:
|
|
try:
|
|
x = upload_file(media)
|
|
url = f"https://telegra.ph/{x[0]}"
|
|
os.remove(media)
|
|
except BaseException:
|
|
return await conv.send_message("Terminated.")
|
|
await setit(event, var, url)
|
|
await conv.send_message("{} has been set.".format(name))
|
|
|
|
|
|
@callback("delmed")
|
|
@owner
|
|
async def dell(event):
|
|
try:
|
|
udB.delete("ALIVE_PIC")
|
|
return await event.edit("Done!")
|
|
except BaseException:
|
|
return await event.edit("Something went wrong...")
|