-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpasswordgen.py
62 lines (51 loc) · 2.4 KB
/
passwordgen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# ---------------------------------------------------------------------------------
#░█▀▄░▄▀▀▄░█▀▄░█▀▀▄░█▀▀▄░█▀▀▀░▄▀▀▄░░░█▀▄▀█
#░█░░░█░░█░█░█░█▄▄▀░█▄▄█░█░▀▄░█░░█░░░█░▀░█
#░▀▀▀░░▀▀░░▀▀░░▀░▀▀░▀░░▀░▀▀▀▀░░▀▀░░░░▀░░▒▀
# 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://mods.codrago.top/banners/passwordgen.png
# meta pic: https://envs.sh/Lmn.webp
# ---------------------------------------------------------------------------------
from .. import loader, utils
import string
import random
@loader.tds
class PassGen(loader.Module):
"""Generate password"""
strings = {
"name": "PassGen",
"no_args": "<emoji document_id=5328145443106873128>✖️</emoji> <b>Where args?</b>",
"pass": "<emoji document_id=5832546462478635761>🔒</emoji> <b>Here your password:</b> ",
}
strings_ru = {
"no_args": "<emoji document_id=5328145443106873128>✖️</emoji> <b>Где аргументы?</b>",
"pass": "<emoji document_id=5832546462478635761>🔒</emoji> <b>Твой пароль:</b> ",
}
@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']},<code>{password}</code>")
@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']}, <code>{password}</code>")