# ---------------------------------------------------------------------------------
#░█▀▄░▄▀▀▄░█▀▄░█▀▀▄░█▀▀▄░█▀▀▀░▄▀▀▄░░░█▀▄▀█
#░█░░░█░░█░█░█░█▄▄▀░█▄▄█░█░▀▄░█░░█░░░█░▀░█
#░▀▀▀░░▀▀░░▀▀░░▀░▀▀░▀░░▀░▀▀▀▀░░▀▀░░░░▀░░▒▀
# Name: Password Generator
# Description: Generate password
# Author: @codrago_m
# ---------------------------------------------------------------------------------
# 🔒 Licensed under the GNU AGPLv3
# 🌐 https://www.gnu.org/licenses/agpl-3.0.html
# ---------------------------------------------------------------------------------
# Author: @codrago
# Commands: pass, passg
# meta developer: @codrago_m
# meta banner: https://raw.githubusercontent.com/coddrago/modules/refs/heads/main/banner.png
# meta pic: https://envs.sh/Hoe.webp
# ---------------------------------------------------------------------------------
from .. import loader, utils
import string
import random
@loader.tds
class PassGen(loader.Module):
"""Generate password"""
strings = {
"name": "PassGen",
"no_args": "✖️ Where args?",
"pass": "🔒 Here your password: ",
}
strings_ru = {
"no_args": "✖️ Где аргументы?",
"pass": "🔒 Твой пароль: ",
}
@loader.command()
async def passcmd(self, message):
"""| Generate password from utils"""
args = int(utils.get_args_raw(message))
password = utils.rand(args)
if not args:
await utils.answer(message, self.strings["no_args"])
else:
await utils.answer(message, f"{self.strings['pass']},{password}")
@loader.command()
async def passgcmd(self, message):
"""| Generate password from string"""
args = int(utils.get_args_raw(message))
characters = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(characters) for _ in range(args))
if not args:
await utils.answer(message, self.strings["no_args"])
else:
await utils.answer(message, f"{self.strings['pass']}, {password}")