Beispiel #1
0
 async def my_background_task(self, message,
                              waiting_message: discord.Message):
     await self.wait_until_ready()
     try:
         original_fucked_text = recumpile_text(message.content)
         fucked_text = (original_fucked_text.encode("utf-8")[:2000 - (
             3 + len(message.author.display_name))]).decode("utf-8")
         # TODO: It is not impossible that recumpile_text generates text longer than 2000 characters!
         #       maybe recumpile_text should have options to limit its generated output length to avoid
         #       either dropping the message or embedding it as a file.
         __log__.info(f"f****d message text: {fucked_text}")
         await waiting_message.edit(
             content=f"<@!{message.author.id}> {fucked_text}")
         for attachment in message.attachments:
             # TODO: quick hack to get images reposted
             await waiting_message.channel.send(content=attachment.url)
         if original_fucked_text != fucked_text:
             raise ValueError(
                 "post-processed discord-ready f****d text not the same likely output was too long"
             )
     except:
         fucked_text = recumpile_text(
             "Oops i had a fucky wucky recumpiling your text! Your text could be too big UWU!"
         )
         await waiting_message.channel.send(
             content=f"<@!{message.author.id}> {fucked_text}")
Beispiel #2
0
def main(argv=None):
    """main entry point"""
    args = get_parser().parse_args(argv)
    init_logging(args, "recumpiler.log")

    if args.seed is not None:
        seed_random(args.seed)

    if args.text:
        fucked_text = recumpile_text(args.text)
        print(fucked_text)
    if args.repl:
        recumpile_repl()
Beispiel #3
0
def recumpile_repl():
    while True:
        text = input("recumpiler>")
        fucked_text = recumpile_text(text)
        print(fucked_text)
Beispiel #4
0
def test_mutate_text_blob_preserve_newlines(text):
    out_str = recumpile_text(text)
    assert isinstance(out_str, str)
    assert "\n" in out_str
    print(out_str)
Beispiel #5
0
def test_mutate_text_blob(text):
    out_str = recumpile_text(text)
    assert isinstance(out_str, str)
    print(out_str)