delete(commands:*|Crypto): remove unused cog

This commit is contained in:
Romain J 2021-04-21 18:00:43 +02:00
parent e63e939d77
commit 4a508b1851
13 changed files with 0 additions and 380 deletions

View file

@ -1,19 +0,0 @@
from collections import namedtuple
from tuxbot.core.bot import Tux
from .crypto import Crypto
from .config import CryptoConfig, HAS_MODELS
VersionInfo = namedtuple("VersionInfo", "major minor micro release_level")
version_info = VersionInfo(major=1, minor=0, micro=0, release_level="alpha")
__version__ = "v{}.{}.{}-{}".format(
version_info.major,
version_info.minor,
version_info.micro,
version_info.release_level,
).replace("\n", "")
def setup(bot: Tux):
bot.add_cog(Crypto(bot))

View file

@ -1,12 +0,0 @@
from typing import Dict
from structured_config import Structure
HAS_MODELS = False
class CryptoConfig(Structure):
pass
extra: Dict[str, Dict] = {}

View file

@ -1,63 +0,0 @@
# import functools
import logging
# import discord
from discord.ext import commands
#
# from tuxbot.cogs.Crypto.functions.extractor import extract
# from tuxbot.cogs.Crypto.functions.sync import encode
from tuxbot.core.bot import Tux
from tuxbot.core.i18n import (
Translator,
)
# from tuxbot.core.utils.functions.extra import group_extra, ContextPlus
log = logging.getLogger("tuxbot.cogs.Crypto")
_ = Translator("Crypto", __file__)
class Crypto(commands.Cog):
def __init__(self, bot: Tux):
self.bot = bot
# @group_extra(name="ralgo")
# async def _ralgo(self, ctx: commands.Context):
# if ctx.invoked_subcommand is None:
# await ctx.send_help("ralgo")
#
# @_ralgo.command(name="encode")
# async def _ralgo_encode(self, ctx: ContextPlus, *, data: str = None):
# try:
# params = await extract(ctx.message.attachments, data, 10000)
# except ValueError:
# return await ctx.send("Invalid data provided")
#
# async with ctx.typing():
# output = await self.bot.loop.run_in_executor(
# None, functools.partial(encode, params)
# )
#
# if params["graphical"]:
# return await ctx.send(file=output)
#
# await ctx.send(output)
#
# @_ralgo.command(name="decode")
# async def _ralgo_decode(self, ctx: ContextPlus, *, data: str = None):
# try:
# params = await extract(ctx.message.attachments, data, 100000)
# except ValueError:
# return await ctx.send("Invalid data provided")
#
# async with ctx.typing():
# output = await self.bot.loop.run_in_executor(
# None, functools.partial(encode, params)
# )
#
# if isinstance(output, discord.File):
# return await ctx.send(file=output)
#
# await ctx.send(output)

View file

@ -1,28 +0,0 @@
# from typing import Optional, NoReturn, Union
#
# from discord import Attachment
# from tuxbot.cogs.Crypto.functions.parser import data_parser
#
#
# async def extract(
# attachments: list[Optional[Attachment]], data: Optional[str], max_size: int
# ) -> dict:
# if not data and len(attachments) == 0:
# raise ValueError
#
# kwargs = data_parser(data)
#
# if attachments and attachments[0]:
# file: Attachment = attachments[0]
# if file.size > max_size:
# raise ValueError
#
# kwargs["message"] = await file.read()
#
# params = {
# "compressed": "compressed" in kwargs.keys(),
# "graphical": "graphical" in kwargs.keys(),
# "chars": kwargs["chars"] if "chars" in kwargs.keys() else (".", ","),
# }
#
# return {"message": kwargs["message"], "params": params}

View file

@ -1,10 +0,0 @@
# https://python-forum.io/Thread-read-a-binary-file-to-find-its-type
def find_ext(content: bytes) -> str:
magic_numbers = {
"png": bytes([0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A])
}
if content.startswith(magic_numbers["png"]):
return "png"
return "txt"

View file

@ -1,36 +0,0 @@
import re
from typing import Optional
def data_parser(data: Optional[str]) -> dict:
output = {
"message": "",
"compressed": False,
"graphical": False,
"chars": tuple,
}
if not data:
return output
if "--compressed" in data:
output["compressed"] = True
data = "".join(data.rsplit("--compressed", 1))
if "--graphical" in data:
output["graphical"] = True
data = "".join(data.rsplit("--graphical", 1))
if "compressed" in output.keys():
del output["compressed"]
if "--chars" in data:
regex = r"--chars=(\S\S)"
if match := re.search(regex, data):
output["chars"] = tuple(match.group()[-2:])
data = "".join(data.rsplit(match.group(), 1))
output["message"] = data.strip()
return output

View file

@ -1,40 +0,0 @@
# from io import BytesIO
# from typing import Union
#
# import discord
# from ralgo.ralgo import Ralgo
# from tuxbot.cogs.Crypto.functions.file import find_ext
#
#
# def encode(params: dict) -> Union[str, discord.File]:
# statement = Ralgo(params["message"])
# params = params["params"]
# encoded = statement.encode(chars=params["chars"])
#
# if params["compressed"]:
# return str(encoded.compress())
# if params["graphical"]:
# output = encoded.graphical().encode()
# return discord.File(BytesIO(output.to_bytes()), "output.png")
#
# return str(encoded)
#
#
# def decode(params: dict) -> Union[str, discord.File]:
# statement = Ralgo(params["message"])
# params = params["params"]
#
# if params["graphical"]:
# output = Ralgo(statement.graphical().decode()).decode()
# elif params["compressed"]:
# output = Ralgo(statement.decompress()).decode()
# else:
# output = statement.decode(chars=params["chars"])
#
# if isinstance(output, bytes):
# return discord.File(BytesIO(output), f"output.{find_ext(output)}")
#
# output = discord.utils.escape_markdown(str(output))
# output = discord.utils.escape_mentions(output)
#
# return output if len(output) > 0 else "no content..."

View file

@ -1,57 +0,0 @@
# French translations for Tuxbot-bot package
# Traductions françaises du paquet Tuxbot-bot.
# Copyright (C) 2020 THE Tuxbot-bot'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Tuxbot-bot package.
# Automatically generated, 2020.
#
msgid ""
msgstr ""
"Project-Id-Version: Tuxbot-bot\n"
"Report-Msgid-Bugs-To: rick@gnous.eu\n"
"POT-Creation-Date: 2020-10-21 01:15+0200\n"
"PO-Revision-Date: 2020-10-21 01:15+0200\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: tuxbot/cogs/Polls/polls.py:55 tuxbot/cogs/Polls/polls.py:176
msgid "**Preparation**"
msgstr ""
#: tuxbot/cogs/Polls/polls.py:204
#, python-brace-format
msgid "Proposed addition for poll #{id}"
msgstr ""
#: tuxbot/cogs/Polls/polls.py:209
msgid "Poll"
msgstr ""
#: tuxbot/cogs/Polls/polls.py:211
msgid "here"
msgstr ""
#: tuxbot/cogs/Polls/polls.py:215
#, python-brace-format
msgid "Requested by {author}"
msgstr ""
#: tuxbot/cogs/Polls/functions/converters.py:21
#: tuxbot/cogs/Polls/functions/converters.py:49
msgid "Please provide a message in this channel"
msgstr ""
#: tuxbot/cogs/Polls/functions/converters.py:30
#: tuxbot/cogs/Polls/functions/converters.py:36
#: tuxbot/cogs/Polls/functions/converters.py:41
#: tuxbot/cogs/Polls/functions/converters.py:46
msgid "Unable to find this poll"
msgstr ""
#: tuxbot/cogs/Polls/functions/converters.py:58
msgid "Your proposal must be smaller than 30"
msgstr ""

View file

@ -1,58 +0,0 @@
# French translations for Tuxbot-bot package
# Traductions françaises du paquet Tuxbot-bot.
# Copyright (C) 2020 THE Tuxbot-bot'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Tuxbot-bot package.
# Automatically generated, 2020.
#
msgid ""
msgstr ""
"Project-Id-Version: Tuxbot-bot\n"
"Report-Msgid-Bugs-To: rick@gnous.eu\n"
"POT-Creation-Date: 2020-10-21 01:15+0200\n"
"PO-Revision-Date: 2020-10-21 01:15+0200\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: tuxbot/cogs/Polls/polls.py:55 tuxbot/cogs/Polls/polls.py:176
msgid "**Preparation**"
msgstr "**Préparation**"
#: tuxbot/cogs/Polls/polls.py:204
#, python-brace-format
msgid "Proposed addition for poll #{id}"
msgstr "Proposition d'ajout pour le sondage #{id}"
#: tuxbot/cogs/Polls/polls.py:209
msgid "Poll"
msgstr "Sondage"
#: tuxbot/cogs/Polls/polls.py:211
msgid "here"
msgstr "ici"
#: tuxbot/cogs/Polls/polls.py:215
#, python-brace-format
msgid "Requested by {author}"
msgstr "Demandée par {author}"
#: tuxbot/cogs/Polls/functions/converters.py:21
#: tuxbot/cogs/Polls/functions/converters.py:49
msgid "Please provide a message in this channel"
msgstr "Veuillez fournir un message dans ce salon"
#: tuxbot/cogs/Polls/functions/converters.py:30
#: tuxbot/cogs/Polls/functions/converters.py:36
#: tuxbot/cogs/Polls/functions/converters.py:41
#: tuxbot/cogs/Polls/functions/converters.py:46
msgid "Unable to find this poll"
msgstr "Impossible de trouver ce sondage"
#: tuxbot/cogs/Polls/functions/converters.py:58
msgid "Your proposal must be smaller than 30"
msgstr "Votre proposition doit être inférieure à 30"

View file

@ -1,56 +0,0 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the Tuxbot-bot package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Tuxbot-bot\n"
"Report-Msgid-Bugs-To: rick@gnous.eu\n"
"POT-Creation-Date: 2021-01-26 16:12+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: tuxbot/cogs/Polls/polls.py:55 tuxbot/cogs/Polls/polls.py:176
msgid "**Preparation**"
msgstr ""
#: tuxbot/cogs/Polls/polls.py:204
#, python-brace-format
msgid "Proposed addition for poll #{id}"
msgstr ""
#: tuxbot/cogs/Polls/polls.py:209
msgid "Poll"
msgstr ""
#: tuxbot/cogs/Polls/polls.py:211
msgid "here"
msgstr ""
#: tuxbot/cogs/Polls/polls.py:215
#, python-brace-format
msgid "Requested by {author}"
msgstr ""
#: tuxbot/cogs/Polls/functions/converters.py:21
#: tuxbot/cogs/Polls/functions/converters.py:49
msgid "Please provide a message in this channel"
msgstr ""
#: tuxbot/cogs/Polls/functions/converters.py:30
#: tuxbot/cogs/Polls/functions/converters.py:36
#: tuxbot/cogs/Polls/functions/converters.py:41
#: tuxbot/cogs/Polls/functions/converters.py:46
msgid "Unable to find this poll"
msgstr ""
#: tuxbot/cogs/Polls/functions/converters.py:58
msgid "Your proposal must be smaller than 30"
msgstr ""

View file

@ -42,7 +42,6 @@ packages: List[str] = [
"tuxbot.cogs.Polls", "tuxbot.cogs.Polls",
"tuxbot.cogs.Custom", "tuxbot.cogs.Custom",
"tuxbot.cogs.Network", "tuxbot.cogs.Network",
# "tuxbot.cogs.Crypto",
] ]