This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
forked from karandon24/Nana-Remix
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nana: Fix and Re-enable kang (Sourcery refactored) (#33)
* Nana: Fix and Re-enable kang Signed-off-by: wulan17 <[email protected]> * 'Refactored by Sourcery' Co-authored-by: wulan17 <[email protected]> Co-authored-by: Sourcery AI <> Signed-off-by: ポキ <[email protected]>
- Loading branch information
1 parent
9c7a8d8
commit 2681579
Showing
2 changed files
with
112 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,123 +1,111 @@ | ||
# # | ||
# # Settings For Sticker | ||
# # | ||
# import asyncio | ||
# from .settings import get_text_settings, get_button_settings | ||
# from pyrogram import filters | ||
# from pyrogram.types import ReplyKeyboardMarkup, Message | ||
# | ||
# Settings For Sticker | ||
# | ||
import asyncio | ||
from .settings import get_text_settings, get_button_settings | ||
from pyrogram import filters | ||
from pyrogram.types import ReplyKeyboardMarkup, Message | ||
|
||
# from nana import setbot, AdminSettings, DB_AVAILABLE, app, Owner, NANA_IMG | ||
# from nana.assistant.database.stickers_db import set_sticker_set, set_stanim_set | ||
# from nana.assistant.__main__ import dynamic_data_filter | ||
from nana import setbot, AdminSettings, DB_AVAILABLE, app, Owner, NANA_IMG | ||
from nana.assistant.database.stickers_db import set_sticker_set, set_stanim_set | ||
from nana.assistant.__main__ import dynamic_data_filter | ||
|
||
# TEMP_KEYBOARD = [] | ||
# USER_SET = {} | ||
# TODEL = {} | ||
TEMP_KEYBOARD = [] | ||
USER_SET = {} | ||
TODEL = {} | ||
|
||
|
||
# @setbot.on_message(filters.user(AdminSettings) & filters.command(["setsticker"])) | ||
# async def get_stickers(_client, message): | ||
# if not DB_AVAILABLE: | ||
# await message.edit("Your database is not avaiable!") | ||
# return | ||
# global TEMP_KEYBOARD, USER_SET | ||
# await app.send_message("@Stickers", "/stats") | ||
# # app.read_history("@Stickers") | ||
# await asyncio.sleep(0.2) | ||
# keyboard = await app.get_history("@Stickers", limit=1) | ||
# keyboard = keyboard[0].reply_markup.keyboard | ||
# for x in keyboard: | ||
# for y in x: | ||
# TEMP_KEYBOARD.append(y) | ||
# await app.send_message("@Stickers", "/cancel") | ||
# msg = await message.reply("Select your stickers for set as kang sticker", | ||
# reply_markup=ReplyKeyboardMarkup(keyboard)) | ||
# USER_SET[message.from_user.id] = msg.message_id | ||
# USER_SET["type"] = 1 | ||
@setbot.on_message(filters.user(AdminSettings) & filters.command(["setsticker"])) | ||
async def get_stickers(client, message): | ||
if not DB_AVAILABLE: | ||
await message.edit("Your database is not avaiable!") | ||
return | ||
global TEMP_KEYBOARD, USER_SET | ||
await app.send_message("@Stickers", "/stats") | ||
await asyncio.sleep(0.2) | ||
keyboard = await app.get_history("@Stickers", limit=1) | ||
keyboard = keyboard[0].reply_markup.keyboard | ||
for x in keyboard: | ||
for y in x: | ||
TEMP_KEYBOARD.append(y) | ||
await app.send_message("@Stickers", "/cancel") | ||
msg = await message.reply("Select your stickers for set as kang sticker", | ||
reply_markup=ReplyKeyboardMarkup(keyboard)) | ||
USER_SET[message.from_user.id] = msg.message_id | ||
USER_SET["type"] = 1 | ||
|
||
@setbot.on_message(filters.user(AdminSettings) & filters.command(["setanimation"])) | ||
async def get_stickers_animation(client, message): | ||
if not DB_AVAILABLE: | ||
await message.edit("Your database is not avaiable!") | ||
return | ||
global TEMP_KEYBOARD, USER_SET | ||
await app.send_message("@Stickers", "/stats") | ||
await asyncio.sleep(0.2) | ||
keyboard = await app.get_history("@Stickers", limit=1) | ||
keyboard = keyboard[0].reply_markup.keyboard | ||
for x in keyboard: | ||
for y in x: | ||
TEMP_KEYBOARD.append(y) | ||
await app.send_message("@Stickers", "/cancel") | ||
msg = await message.reply("Select your stickers for set as kang animation sticker", | ||
reply_markup=ReplyKeyboardMarkup(keyboard)) | ||
USER_SET[message.from_user.id] = msg.message_id | ||
USER_SET["type"] = 2 | ||
|
||
# # app.read_history("@Stickers") | ||
def get_stickerlist(client,message): | ||
if not DB_AVAILABLE: | ||
return | ||
global TEMP_KEYBOARD, USER_SET | ||
if message.from_user and message.from_user.id in list(USER_SET): | ||
return True | ||
else: | ||
TEMP_KEYBOARD = [] | ||
USER_SET = {} | ||
|
||
# @setbot.on_message(filters.user(AdminSettings) & filters.command(["setanimation"])) | ||
# async def get_stickers_animation(_client, message): | ||
# if not DB_AVAILABLE: | ||
# await message.edit("Your database is not avaiable!") | ||
# return | ||
# global TEMP_KEYBOARD, USER_SET | ||
# await app.send_message("@Stickers", "/stats") | ||
# # app.read_history("@Stickers") | ||
# await asyncio.sleep(0.2) | ||
# keyboard = await app.get_history("@Stickers", limit=1) | ||
# keyboard = keyboard[0].reply_markup.keyboard | ||
# for x in keyboard: | ||
# for y in x: | ||
# TEMP_KEYBOARD.append(y) | ||
# await app.send_message("@Stickers", "/cancel") | ||
# msg = await message.reply("Select your stickers for set as kang animation sticker", | ||
# reply_markup=ReplyKeyboardMarkup(keyboard)) | ||
# USER_SET[message.from_user.id] = msg.message_id | ||
# USER_SET["type"] = 2 | ||
@setbot.on_message(get_stickerlist) | ||
async def set_stickers(client, message): | ||
if not DB_AVAILABLE: | ||
await message.edit("Your database is not avaiable!") | ||
return | ||
global TEMP_KEYBOARD, USER_SET | ||
if message.text in TEMP_KEYBOARD: | ||
await client.delete_messages(message.chat.id, USER_SET[message.from_user.id]) | ||
if USER_SET["type"] == 1: | ||
set_sticker_set(message.from_user.id, message.text) | ||
elif USER_SET["type"] == 2: | ||
set_stanim_set(message.from_user.id, message.text) | ||
status = "Ok, sticker was set to `{}`".format(message.text) | ||
else: | ||
status = "Invalid pack selected." | ||
TEMP_KEYBOARD = [] | ||
USER_SET = {} | ||
text = await get_text_settings() | ||
text += "\n{}".format(status) | ||
button = await get_button_settings() | ||
await setbot.send_photo(message.chat.id, NANA_IMG, caption=text, reply_markup=button) | ||
|
||
|
||
# # app.read_history("@Stickers") | ||
|
||
# def get_stickerlist(message): | ||
# if not DB_AVAILABLE: | ||
# return | ||
# global TEMP_KEYBOARD, USER_SET | ||
# if message.from_user and message.from_user.id in list(USER_SET): | ||
# return True | ||
# else: | ||
# TEMP_KEYBOARD = [] | ||
# USER_SET = {} | ||
|
||
|
||
# @setbot.on_message(get_stickerlist) | ||
# async def set_stickers(client, message): | ||
# if not DB_AVAILABLE: | ||
# await message.edit("Your database is not avaiable!") | ||
# return | ||
# global TEMP_KEYBOARD, USER_SET | ||
# if message.text in TEMP_KEYBOARD: | ||
# await client.delete_messages(message.chat.id, USER_SET[message.from_user.id]) | ||
# if USER_SET["type"] == 1: | ||
# set_sticker_set(message.from_user.id, message.text) | ||
# elif USER_SET["type"] == 2: | ||
# set_stanim_set(message.from_user.id, message.text) | ||
# status = "Ok, sticker was set to `{}`".format(message.text) | ||
# TEMP_KEYBOARD = [] | ||
# USER_SET = {} | ||
# else: | ||
# status = "Invalid pack selected." | ||
# TEMP_KEYBOARD = [] | ||
# USER_SET = {} | ||
# text = await get_text_settings() | ||
# text += "\n{}".format(status) | ||
# button = await get_button_settings() | ||
# await setbot.send_photo(message.chat.id, NANA_IMG, caption=text, reply_markup=button) | ||
|
||
|
||
# @setbot.on_callback_query(dynamic_data_filter("setsticker")) | ||
# async def settings_sticker(_client, message): | ||
# if not DB_AVAILABLE: | ||
# await message.edit("Your database is not avaiable!") | ||
# return | ||
# global TEMP_KEYBOARD, USER_SET | ||
# await app.send_message("@Stickers", "/stats") | ||
# # app.read_history("@Stickers") | ||
# await asyncio.sleep(0.2) | ||
# try: | ||
# keyboard = await app.get_history("@Stickers", limit=1) | ||
# keyboard = keyboard[0].reply_markup.keyboard | ||
# except: | ||
# await message.edit("You dont have any sticker pack!\nAdd stickers pack in @Stickers ") | ||
# return | ||
# for x in keyboard: | ||
# for y in x: | ||
# TEMP_KEYBOARD.append(y) | ||
# await app.send_message("@Stickers", "/cancel") | ||
# await message.delete() | ||
# msg = await setbot.send_message(Owner, "Select your stickers for set as kang animation sticker", | ||
# reply_markup=ReplyKeyboardMarkup(keyboard)) | ||
# USER_SET[message.from_user.id] = msg.message_id | ||
# USER_SET["type"] = 2 | ||
@setbot.on_callback_query(dynamic_data_filter("setsticker")) | ||
async def settings_sticker(client, message): | ||
if not DB_AVAILABLE: | ||
await message.edit("Your database is not avaiable!") | ||
return | ||
global TEMP_KEYBOARD, USER_SET | ||
await app.send_message("@Stickers", "/stats") | ||
await asyncio.sleep(0.2) | ||
try: | ||
keyboard = await app.get_history("@Stickers", limit=1) | ||
keyboard = keyboard[0].reply_markup.keyboard | ||
except: | ||
await message.edit("You dont have any sticker pack!\nAdd stickers pack in @Stickers ") | ||
return | ||
for x in keyboard: | ||
for y in x: | ||
TEMP_KEYBOARD.append(y) | ||
await app.send_message("@Stickers", "/cancel") | ||
await message.delete() | ||
msg = await setbot.send_message(Owner, "Select your stickers for set as kang animation sticker", | ||
reply_markup=ReplyKeyboardMarkup(keyboard)) | ||
USER_SET[message.from_user.id] = msg.message_id | ||
USER_SET["type"] = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters