Skip to content

Conversation

@sourcery-ai
Copy link

@sourcery-ai sourcery-ai bot commented Nov 1, 2023

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from MuRuLOSE November 1, 2023 11:54
PasswordUtils.py Outdated
Comment on lines -43 to +45
password = ''.join(random.choice(letters)+random.choice(symbols) for i in range(8))
password = ''.join(
random.choice(letters) + random.choice(symbols) for _ in range(8)
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PasswordUtils.passwordgen refactored with the following changes:

Comment on lines -58 to +88
''' - [Ник перевода] [Сколько переводить] - Перевод лимитов'''
args = utils.get_args_split_by(message, " ")
async with self.client.conversation("@mine_evo_bot") as conv:
await conv.send_message("б")
res = await conv.get_response()
pattern = "<b>Баланс:</b> (.*?)\n"
match = re.search(pattern, res.text,re.DOTALL)
if match:
balance = match.group(1)
balance = match.group(1)
await conv.send_message(f"Перевести {args[0]} {balance}")
res = await conv.get_response()
if "недостаточно денег" in res.text:
await utils.answer(message,"⚠️ Откройте конверт! Я не смог выяснить лимит игрока из-за бага майнево!")
return
pattern = "\n(.*?)$"
match = re.search(pattern, res.message, re.DOTALL)
if match:
sum = match.group(1).replace("$","")
''' - [Ник перевода] [Сколько переводить] - Перевод лимитов'''
args = utils.get_args_split_by(message, " ")
async with self.client.conversation("@mine_evo_bot") as conv:
await conv.send_message("б")
res = await conv.get_response()
pattern = "<b>Баланс:</b> (.*?)\n"
match = re.search(pattern, res.text,re.DOTALL)
if match:
balance = match.group(1)
balance = match.group(1)
await conv.send_message(f"Перевести {args[0]} {balance}")
res = await conv.get_response()
if "недостаточно денег" in res.text:
await utils.answer(message,"⚠️ Откройте конверт! Я не смог выяснить лимит игрока из-за бага майнево!")
return
pattern = "\n(.*?)$"
if match := re.search(pattern, res.message, re.DOTALL):
sum = match.group(1).replace("$","")

conv.cancel()
ost = 0
self.set("full",args[1])
await utils.answer(message,"💖 Я начал переводить!")
for i in range(int(args[1])+1):
self._db.get(__name__,"ost",0)
await self.client.send_message("@mine_evo_bot",f"Перевести {args[0]} {sum}")
await asyncio.sleep(self.config["time_perevod"])
ost += 1
self.set("ost",ost)
await utils.answer(message,"💸 Я всё перевёл")
await self.client.send_message(self._backup_channel,f"🎉 <b>Я перевел все лимиты игроку:</b> <code>{args[0]}</code> <b>В количстве:</b> <code>{args[1]}</code>")
conv.cancel()
ost = 0
self.set("full",args[1])
await utils.answer(message,"💖 Я начал переводить!")
for _ in range(int(args[1])+1):
self._db.get(__name__,"ost",0)
await self.client.send_message("@mine_evo_bot",f"Перевести {args[0]} {sum}")
await asyncio.sleep(self.config["time_perevod"])
ost += 1
self.set("ost",ost)
await utils.answer(message,"💸 Я всё перевёл")
await self.client.send_message(self._backup_channel,f"🎉 <b>Я перевел все лимиты игроку:</b> <code>{args[0]}</code> <b>В количстве:</b> <code>{args[1]}</code>")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PerevodLimitsX.perevodx refactored with the following changes:

Comment on lines -50 to +55
elif isinstance(peer, PeerChat) or isinstance(peer, PeerChannel):
elif isinstance(peer, (PeerChat, PeerChannel)):
added = self.strings("added").format(
message.chat_id,
entity.title
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PinMoreChats.pinchat refactored with the following changes:

Comment on lines -91 to +97
if isinstance(peer, PeerUser):
name = entity.first_name
elif isinstance(peer, PeerChat):
name = entity.title
elif isinstance(peer, PeerChannel):
name = entity.title
else:
name = entity.title
name = entity.first_name if isinstance(peer, PeerUser) else entity.title
except Exception:
pass
messages = await self.client.get_messages(chat_id, limit=1)
max_message_id = messages[0].id
chats += f"<a href=tg://privatepost?channel={chat}&post={max_message_id}>{name}</a>\n"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function PinMoreChats.listpinchats refactored with the following changes:

SpyEVO.py Outdated
Comment on lines -30 to +79
converts = self.get("converts",0)
r_converts = self.get("r_converts",0)
case = self.get("case",0)
r_case = self.get("r_case",0)
mif = self.get("mif",0)
crystal = self.get("crystal",0)
plasma = self.get("plasma",0)
zv = self.get("zv",0)
scrap = self.get("scrap",0)
medals = self.get("medals",0)

if message.chat_id == 5522271758 and message.text == "✉ Ты нашел(ла) конверт.":
converts += 1
self.set("converts",converts)
if message.chat_id == 5522271758 and message.text == "🧧 Ты нашел(ла) редкий конверт.":
r_converts +=1
self.set("r_converts",converts)
if message.chat_id == 5522271758 and message.text == "📦 Ты нашел(ла) Кейс!":
case += 1
self.set("case",case)
if message.chat_id == 5522271758 and message.text == "🗳 Ты нашел(ла) Редкий Кейс!":
r_case += 1
self.set("r_case",r_case)
if message.chat_id == 5522271758 and message.raw_text == "🕋 Ты нашел(ла) Мифический Кейс!":
mif += 1
self.set("mif",mif)
if message.chat_id == 5522271758 and message.raw_text == "💎 Ты нашел(ла) Кристальный Кейс!":
crystal += 1
self.set("crystal",crystal)
if message.chat_id == 5522271758 and "🎆 Ты нашел(ла) 1 плазму" in message.text:
plasma += 1
self.set("plasma",plasma)
if message.chat_id == 5522271758 and "💫" in message.text:
zv += 1
self.set("zv",zv)
if message.chat_id == 5522271758 and "🎆 Ты нашел(ла) 2 плазмы" in message.text:
plasma += 2
self.set("plasma",plasma)
if message.chat_id == 5522271758 and "Медаль" in message.text:
pattern = "Медаль +(.*?)</b>"
match = re.search(pattern, message.text, re.DOTALL)
if match:
medali = int(match.group(1))
medals += medali
self.set("medals",medals)
if message.chat_id == 5522271758 and "Скрап" in message.text:
pattern = "Скрап +(.*?)</b>"
match = re.search(pattern, message.text, re.DOTALL)
if match:
scrapi = int(match.group(1))
scrap += scrapi
self.set("scrap",scrap)
converts = self.get("converts",0)
r_converts = self.get("r_converts",0)
case = self.get("case",0)
r_case = self.get("r_case",0)
mif = self.get("mif",0)
crystal = self.get("crystal",0)
plasma = self.get("plasma",0)
zv = self.get("zv",0)
scrap = self.get("scrap",0)
medals = self.get("medals",0)

if message.chat_id == 5522271758 and message.text == "✉ Ты нашел(ла) конверт.":
converts += 1
self.set("converts",converts)
if message.chat_id == 5522271758 and message.text == "🧧 Ты нашел(ла) редкий конверт.":
r_converts +=1
self.set("r_converts",converts)
if message.chat_id == 5522271758 and message.text == "📦 Ты нашел(ла) Кейс!":
case += 1
self.set("case",case)
if message.chat_id == 5522271758 and message.text == "🗳 Ты нашел(ла) Редкий Кейс!":
r_case += 1
self.set("r_case",r_case)
if message.chat_id == 5522271758 and message.raw_text == "🕋 Ты нашел(ла) Мифический Кейс!":
mif += 1
self.set("mif",mif)
if message.chat_id == 5522271758 and message.raw_text == "💎 Ты нашел(ла) Кристальный Кейс!":
crystal += 1
self.set("crystal",crystal)
if message.chat_id == 5522271758 and "🎆 Ты нашел(ла) 1 плазму" in message.text:
plasma += 1
self.set("plasma",plasma)
if message.chat_id == 5522271758 and "💫" in message.text:
zv += 1
self.set("zv",zv)
if message.chat_id == 5522271758 and "🎆 Ты нашел(ла) 2 плазмы" in message.text:
plasma += 2
self.set("plasma",plasma)
if message.chat_id == 5522271758 and "Медаль" in message.text:
pattern = "Медаль +(.*?)</b>"
if match := re.search(pattern, message.text, re.DOTALL):
medali = int(match.group(1))
medals += medali
self.set("medals",medals)
if message.chat_id == 5522271758 and "Скрап" in message.text:
pattern = "Скрап +(.*?)</b>"
if match := re.search(pattern, message.text, re.DOTALL):
scrapi = int(match.group(1))
scrap += scrapi
self.set("scrap",scrap)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SpyEVO.watcher refactored with the following changes:

self._chats.append(message.chat_id)
added = True
elif message.chat_id in self._chats:
else:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Autoreader.autoread refactored with the following changes:

autoreader.py Outdated
Comment on lines -91 to +98

if str(args).startswith("-100"):
value = int(str(args)[4:])

elif args > 2**64 - 1 or args < 0:
await utils.answer(message,"Неверный айди!")
else:
await self.client.send_read_acknowledge(int(args),clear_mentions=True)
await self.client.send_read_acknowledge(args, clear_mentions=True)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Autoreader.read refactored with the following changes:

filters.py Outdated
Comment on lines -41 to -49

elif filter_txt == "capitalize":
try:
await message.edit(message.text.capitalize())
except Exception:
pass
elif filter_txt == "off":
pass # Ну а чо делать

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function TextFilters.watcher refactored with the following changes:

This removes the following comments ( why? ):

# Ну а чо делать

sendmsg.py Outdated
message.message = " ".join(args.split()[1:])
try:
if error == False:
if not error:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function SendMSGA.SendMSG refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant