Files
Ultroid-fork/assistant/api_setter.py
xditya c4966f772a Initial Commit
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>
2021-02-22 06:19:43 +05:30

44 lines
1.2 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/>.
from . import *
# main menu for api setting
@callback("apiset")
@owner
async def apiset(event):
await event.edit(
"Choose which API you want to set.",
buttons=[[Button.inline("Remove.bg", data="rmbg")]],
)
# remove.bg api
@callback("rmbg")
@owner
async def rmbgapi(event):
await event.delete()
pru = event.sender_id
var = "RMBG_API"
name = "Remove.bg API Key"
async with event.client.conversation(pru) as conv:
await conv.send_message(
"**remove.bg API**\nEnter your API key from remove.bg.\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))