Change encode/decode command format
This commit is contained in:
parent
9c9e0c7a30
commit
bbfdcdc57f
1 changed files with 37 additions and 19 deletions
|
@ -156,30 +156,38 @@ class DevCog(commands.Cog):
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await ctx.send("Usage: encode <method> <data>")
|
await ctx.send("Usage: encode <method> <data>")
|
||||||
|
|
||||||
@_encode.command(name="b64e")
|
@_encode.command(name="b64")
|
||||||
async def _b64e(self, ctx, *, data: str):
|
async def _b64e(self, ctx, *, data: str):
|
||||||
"""Base64 encoding"""
|
"""Base64 encoding"""
|
||||||
await ctx.send(base64.b64encode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(base64.b64encode(data.encode("UTF-8")).decode("UTF-8"))
|
||||||
|
|
||||||
@_encode.command(name="b16e")
|
@_encode.command(name="b16")
|
||||||
async def _b16e(self, ctx, *, data: str):
|
async def _b16e(self, ctx, *, data: str):
|
||||||
"""Base16 encoding"""
|
"""Base16 encoding"""
|
||||||
await ctx.send(base64.b16encode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.b16encode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
@_encode.command(name="b32e")
|
@_encode.command(name="b32")
|
||||||
async def _b32e(self, ctx, *, data: str):
|
async def _b32e(self, ctx, *, data: str):
|
||||||
"""Base32 encoding"""
|
"""Base32 encoding"""
|
||||||
await ctx.send(base64.b32encode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.b32encode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
@_encode.command(name="a85e")
|
@_encode.command(name="a85")
|
||||||
async def _a85e(self, ctx, *, data: str):
|
async def _a85e(self, ctx, *, data: str):
|
||||||
"""ASCII85 encoding"""
|
"""ASCII85 encoding"""
|
||||||
await ctx.send(base64.a85encode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.a85encode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
@_encode.command(name="b85e")
|
@_encode.command(name="b85")
|
||||||
async def _b85e(self, ctx, *, data: str):
|
async def _b85e(self, ctx, *, data: str):
|
||||||
"""Base85 encoding"""
|
"""Base85 encoding"""
|
||||||
await ctx.send(base64.b85encode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.b85encode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
@commands.group()
|
@commands.group()
|
||||||
async def _decode(self, ctx):
|
async def _decode(self, ctx):
|
||||||
|
@ -187,30 +195,40 @@ class DevCog(commands.Cog):
|
||||||
if ctx.invoked_subcommand is None:
|
if ctx.invoked_subcommand is None:
|
||||||
await ctx.send("Usage: decode <method> <data>")
|
await ctx.send("Usage: decode <method> <data>")
|
||||||
|
|
||||||
@_decode.command(name="b64d")
|
@_decode.command(name="b64")
|
||||||
async def _b64d(self, ctx, *, data: str):
|
async def _b64d(self, ctx, *, data: str):
|
||||||
"""Base64 decoding"""
|
"""Base64 decoding"""
|
||||||
await ctx.send(base64.b64decode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.b64decode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
@_decode.command(name="b16d")
|
@_decode.command(name="b16")
|
||||||
async def _b16d(self, ctx, *, data: str):
|
async def _b16d(self, ctx, *, data: str):
|
||||||
"""Base16 decoding"""
|
"""Base16 decoding"""
|
||||||
await ctx.send(base64.b16decode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.b16decode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
@_decode.command(name="b32d")
|
@_decode.command(name="b32")
|
||||||
async def _b32d(self, ctx, *, data: str):
|
async def _b32d(self, ctx, *, data: str):
|
||||||
"""Base32 decoding"""
|
"""Base32 decoding"""
|
||||||
await ctx.send(base64.b32decode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.b32decode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
@_decode.command(name="a85d")
|
@_decode.command(name="a85")
|
||||||
async def _a85d(self, ctx, *, data: str):
|
async def _a85d(self, ctx, *, data: str):
|
||||||
"""ASCII85 decoding"""
|
"""ASCII85 decoding"""
|
||||||
await ctx.send(base64.a85decode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.a85decode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
@_decode.command(name="b85d")
|
@_decode.command(name="b85")
|
||||||
async def _b85d(self, ctx, *, data: str):
|
async def _b85d(self, ctx, *, data: str):
|
||||||
"""Base85 decoding"""
|
"""Base85 decoding"""
|
||||||
await ctx.send(base64.b85decode(data.encode("UTF-8")).decode("UTF-8"))
|
await ctx.send(
|
||||||
|
"`" + base64.b85decode(data.encode("UTF-8")).decode("UTF-8") + "`"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|
Loading…
Add table
Reference in a new issue