From bcd470387993852a6e3f090cb174dd4018bea0f7 Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:33:18 -0600 Subject: [PATCH 01/13] gen.py uwu --- bot/commands/fun/gen.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 bot/commands/fun/gen.py diff --git a/bot/commands/fun/gen.py b/bot/commands/fun/gen.py new file mode 100644 index 0000000..2cfac5d --- /dev/null +++ b/bot/commands/fun/gen.py @@ -0,0 +1,28 @@ +from craiyon import Craiyon +from bot.config import Config, Embed +from bot.base import Command +from io import BytesIO +import base64 +import time +from discox.bot.events.blocked_prompts import blocked + +class cmd(Command): + """ A discord command instance. """ + + name = "gen" + usage = "gen <*prompt>" + description = "Uses the Craiyon AI API to generate an image with a given prompt" + + async def execute(self, arguments, message, prompt) -> None: + if prompt.lower() in blocked: + await message.channel.send("I'm not generating that you meanie >:( It's NSFW! Try something else!") + return + + generator = Craiyon() + result = generator.generate(prompt) + images = result.images + embed = Embed(title="Here is the generated image") + embed.set_image(images) + + + await message.channel.send(embed=embed) \ No newline at end of file From 40e46b225f6c978b968d33022c5413010143ce62 Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 11:33:46 -0600 Subject: [PATCH 02/13] blocked prompts for gen.py uwu --- bot/events/blocked_prompts.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 bot/events/blocked_prompts.py diff --git a/bot/events/blocked_prompts.py b/bot/events/blocked_prompts.py new file mode 100644 index 0000000..1bb78e5 --- /dev/null +++ b/bot/events/blocked_prompts.py @@ -0,0 +1,26 @@ +blocked = [ + "nsfw", + "pussy", + "gore", + "murder", + "penis", + "cat", + "emacs", + "porn", + "vagina", + "dick", + "sex", + "intercourse", + "bondage", + "bdsm", + "fetish", + "kink", + "pegging", + "peg", + "anal", + "vaginal", + "erotic" + + + +] \ No newline at end of file From e4a79fc6e030ddba1db96f6204333f8c7157ba93 Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 13:50:34 -0600 Subject: [PATCH 03/13] added notepad --- bot/events/blocked_prompts.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bot/events/blocked_prompts.py b/bot/events/blocked_prompts.py index 1bb78e5..cd12351 100644 --- a/bot/events/blocked_prompts.py +++ b/bot/events/blocked_prompts.py @@ -19,8 +19,7 @@ "peg", "anal", "vaginal", - "erotic" + "erotic", + "notepad - - -] \ No newline at end of file +] From 4894080818dcfaf460e4be926b64cf6ec73d4d29 Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 13:55:38 -0600 Subject: [PATCH 04/13] updated with EVEN BETTER code --- bot/commands/fun/gen.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/bot/commands/fun/gen.py b/bot/commands/fun/gen.py index 2cfac5d..accb1ed 100644 --- a/bot/commands/fun/gen.py +++ b/bot/commands/fun/gen.py @@ -1,28 +1,33 @@ -from craiyon import Craiyon -from bot.config import Config, Embed -from bot.base import Command from io import BytesIO import base64 import time -from discox.bot.events.blocked_prompts import blocked +from craiyon import Craiyon +from bot.commands.fun.__blocked_prompts import blocked +from bot.config import Config, Embed +from bot.base import Command + class cmd(Command): """ A discord command instance. """ - +# name = "gen" usage = "gen <*prompt>" description = "Uses the Craiyon AI API to generate an image with a given prompt" - async def execute(self, arguments, message, prompt) -> None: + async def execute(self, arguments, message) -> None: + prompt = arguments[0] if prompt.lower() in blocked: await message.channel.send("I'm not generating that you meanie >:( It's NSFW! Try something else!") return + + loadingE = Embed(title=f"Image {prompt} currently generating, please wait a moment!") + loadingM = await message.channel.send(embed=loadingE) generator = Craiyon() result = generator.generate(prompt) images = result.images embed = Embed(title="Here is the generated image") - embed.set_image(images) + embed.set_image(url=images[0]) - - await message.channel.send(embed=embed) \ No newline at end of file + await loadingM.delete() + await message.channel.send(embed=embed) From 7ad4754644e65210bf5ce7bb447d838cce038c9c Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 14:15:08 -0600 Subject: [PATCH 05/13] Update and rename blocked_prompts.py to __blocked_prompts.py --- bot/events/{blocked_prompts.py => __blocked_prompts.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename bot/events/{blocked_prompts.py => __blocked_prompts.py} (95%) diff --git a/bot/events/blocked_prompts.py b/bot/events/__blocked_prompts.py similarity index 95% rename from bot/events/blocked_prompts.py rename to bot/events/__blocked_prompts.py index cd12351..61220fc 100644 --- a/bot/events/blocked_prompts.py +++ b/bot/events/__blocked_prompts.py @@ -20,6 +20,6 @@ "anal", "vaginal", "erotic", - "notepad + "notepad" ] From fe84f5ef4f11b4d6c777db65aefa53ba82522d08 Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 14:16:20 -0600 Subject: [PATCH 06/13] sdwkjhfsjkhsjkdhfj --- bot/commands/fun/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/commands/fun/gen.py b/bot/commands/fun/gen.py index accb1ed..f431b4a 100644 --- a/bot/commands/fun/gen.py +++ b/bot/commands/fun/gen.py @@ -2,7 +2,7 @@ import base64 import time from craiyon import Craiyon -from bot.commands.fun.__blocked_prompts import blocked +from bot.events.__blocked_commands import blocked from bot.config import Config, Embed from bot.base import Command From 4419ce9b6a85bd308c8bb47f255e08a6e63d4e1c Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 15:37:18 -0600 Subject: [PATCH 07/13] delete to move (idk how ot make files in the github web) --- bot/events/__blocked_prompts.py | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 bot/events/__blocked_prompts.py diff --git a/bot/events/__blocked_prompts.py b/bot/events/__blocked_prompts.py deleted file mode 100644 index 61220fc..0000000 --- a/bot/events/__blocked_prompts.py +++ /dev/null @@ -1,25 +0,0 @@ -blocked = [ - "nsfw", - "pussy", - "gore", - "murder", - "penis", - "cat", - "emacs", - "porn", - "vagina", - "dick", - "sex", - "intercourse", - "bondage", - "bdsm", - "fetish", - "kink", - "pegging", - "peg", - "anal", - "vaginal", - "erotic", - "notepad" - -] From fb7a8c0ce2acf70b59c235c1179721433bc3df8e Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 15:37:49 -0600 Subject: [PATCH 08/13] moved it here uwu --- bot/commands/utility/__blocked_prompts.py | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 bot/commands/utility/__blocked_prompts.py diff --git a/bot/commands/utility/__blocked_prompts.py b/bot/commands/utility/__blocked_prompts.py new file mode 100644 index 0000000..61220fc --- /dev/null +++ b/bot/commands/utility/__blocked_prompts.py @@ -0,0 +1,25 @@ +blocked = [ + "nsfw", + "pussy", + "gore", + "murder", + "penis", + "cat", + "emacs", + "porn", + "vagina", + "dick", + "sex", + "intercourse", + "bondage", + "bdsm", + "fetish", + "kink", + "pegging", + "peg", + "anal", + "vaginal", + "erotic", + "notepad" + +] From 5486fa779940ffb695f2257bcc77ba893e8f9155 Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 15:38:43 -0600 Subject: [PATCH 09/13] updated the import for the new file location of blocked prompts UwU --- bot/commands/fun/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/commands/fun/gen.py b/bot/commands/fun/gen.py index f431b4a..a5be340 100644 --- a/bot/commands/fun/gen.py +++ b/bot/commands/fun/gen.py @@ -2,7 +2,7 @@ import base64 import time from craiyon import Craiyon -from bot.events.__blocked_commands import blocked +from bot.commands.utility.__blocked_prompts import blocked from bot.config import Config, Embed from bot.base import Command From 6a3179696497791b1f223f0a5e6100812d7f7ef7 Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 16:02:25 -0600 Subject: [PATCH 10/13] fixed bypass for blocked prompts --- bot/commands/fun/gen.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bot/commands/fun/gen.py b/bot/commands/fun/gen.py index a5be340..def918d 100644 --- a/bot/commands/fun/gen.py +++ b/bot/commands/fun/gen.py @@ -2,7 +2,7 @@ import base64 import time from craiyon import Craiyon -from bot.commands.utility.__blocked_prompts import blocked +from bot.commands.fun.__blocked_prompts import blocked from bot.config import Config, Embed from bot.base import Command @@ -16,11 +16,12 @@ class cmd(Command): async def execute(self, arguments, message) -> None: prompt = arguments[0] - if prompt.lower() in blocked: - await message.channel.send("I'm not generating that you meanie >:( It's NSFW! Try something else!") - return + for word in prompt.split(): + if word.lower() in blocked: + await message.channel.send("I'm not generating that you meanie >:( It's NSFW! Try something else!") + return - loadingE = Embed(title=f"Image {prompt} currently generating, please wait a moment!") + loadingE = Embed(title=f"Image '{prompt}' currently generating, please wait a moment!") loadingM = await message.channel.send(embed=loadingE) generator = Craiyon() From 219417f7f8ebdf90a1c6c7b35941ccca787a8d7c Mon Sep 17 00:00:00 2001 From: Neptuneia <57576932+Neptuneia@users.noreply.github.com> Date: Wed, 5 Apr 2023 16:04:11 -0600 Subject: [PATCH 11/13] Update gen.py --- bot/commands/fun/gen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot/commands/fun/gen.py b/bot/commands/fun/gen.py index def918d..3e9cc23 100644 --- a/bot/commands/fun/gen.py +++ b/bot/commands/fun/gen.py @@ -2,7 +2,7 @@ import base64 import time from craiyon import Craiyon -from bot.commands.fun.__blocked_prompts import blocked +from bot.commands.utility.__blocked_prompts import blocked from bot.config import Config, Embed from bot.base import Command From fb5d45a1f6e09a24218350d1204870bfa993b382 Mon Sep 17 00:00:00 2001 From: xsnowstorm <118460071+xsnowstorm@users.noreply.github.com> Date: Thu, 6 Apr 2023 06:17:36 +0000 Subject: [PATCH 12/13] Added craiyon to dependencies --- poetry.lock | 192 ++++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 1 + requirements.txt | 10 +++ 3 files changed, 201 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index deb8d08..5dc2216 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,34 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. + +[[package]] +name = "aiofile" +version = "3.8.5" +description = "Asynchronous file operations." +category = "main" +optional = false +python-versions = ">=3.7, <4" +files = [ + {file = "aiofile-3.8.5-py3-none-any.whl", hash = "sha256:6644b61ab143a8e516920cdb02d5b46f89c0a37ef036417720f653b5ed31a8c9"}, + {file = "aiofile-3.8.5.tar.gz", hash = "sha256:bb1ca0b2c4ef3b78f5012a2a3919a4151f873b6aabdc73a7b9b8e94edb2e01ae"}, +] + +[package.dependencies] +caio = ">=0.9.0,<0.10.0" + +[package.extras] +develop = ["aiomisc-pytest", "coveralls", "pytest", "pytest-cov", "pytest-rst"] + +[[package]] +name = "aiofiles" +version = "23.1.0" +description = "File support for asyncio." +category = "main" +optional = false +python-versions = ">=3.7,<4.0" +files = [ + {file = "aiofiles-23.1.0-py3-none-any.whl", hash = "sha256:9312414ae06472eb6f1d163f555e466a23aed1c8f60c30cccf7121dba2e53eb2"}, + {file = "aiofiles-23.1.0.tar.gz", hash = "sha256:edd247df9a19e0db16534d4baaf536d6609a43e1de5401d7a4c1c148753a1635"}, +] [[package]] name = "aiohttp" @@ -128,6 +158,22 @@ PyMySQL = ">=1.0" rsa = ["PyMySQL[rsa] (>=1.0)"] sa = ["sqlalchemy (>=1.0,<1.4)"] +[[package]] +name = "aiopath" +version = "0.6.11" +description = "📁 Async pathlib for Python" +category = "main" +optional = false +python-versions = ">=3.10" +files = [ + {file = "aiopath-0.6.11-py2.py3-none-any.whl", hash = "sha256:7b1f1aa3acb422050908ac3c4755b5e43f625111be003f1bfc7dc2193027c45d"}, + {file = "aiopath-0.6.11.tar.gz", hash = "sha256:2f0d4d9195281612c6508cbfa12ac3184c31540d13b9e6215a325897da59decd"}, +] + +[package.dependencies] +aiofile = ">=3.5.0,<4" +anyio = ">=3.2.0,<4" + [[package]] name = "aiosignal" version = "1.3.1" @@ -155,6 +201,27 @@ files = [ {file = "aiosqlite-0.18.0.tar.gz", hash = "sha256:faa843ef5fb08bafe9a9b3859012d3d9d6f77ce3637899de20606b7fc39aa213"}, ] +[[package]] +name = "anyio" +version = "3.6.2" +description = "High level compatibility layer for multiple asynchronous event loop implementations" +category = "main" +optional = false +python-versions = ">=3.6.2" +files = [ + {file = "anyio-3.6.2-py3-none-any.whl", hash = "sha256:fbbe32bd270d2a2ef3ed1c5d45041250284e31fc0a4df4a5a6071842051a51e3"}, + {file = "anyio-3.6.2.tar.gz", hash = "sha256:25ea0d673ae30af41a0c442f81cf3b38c7e79fdc7b60335a4c14e05eb0947421"}, +] + +[package.dependencies] +idna = ">=2.8" +sniffio = ">=1.1" + +[package.extras] +doc = ["packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme"] +test = ["contextlib2", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (<0.15)", "uvloop (>=0.15)"] +trio = ["trio (>=0.16,<0.22)"] + [[package]] name = "async-timeout" version = "4.0.2" @@ -221,6 +288,52 @@ d = ["aiohttp (>=3.7.4)"] jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] uvloop = ["uvloop (>=0.15.2)"] +[[package]] +name = "caio" +version = "0.9.12" +description = "Asynchronous file IO for Linux MacOS or Windows." +category = "main" +optional = false +python-versions = ">=3.7, <4" +files = [ + {file = "caio-0.9.12-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:df395e7e1c2025b3f32dbeff20a8b6491959fac8fbd5a9c2d452bf1f5c0ca2bf"}, + {file = "caio-0.9.12-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:acd31b7828c6683bc46e467a32359f08c686d4c25a7e645c029a07c36685fea7"}, + {file = "caio-0.9.12-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c0b7ffb561ca5c24e7f080aaa73ebb143ae659bd69645a748b332762c389349f"}, + {file = "caio-0.9.12-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6285d772ae3a55e758b1bd3bc34f095757e4af45dcc30a183becf9bbdead8ced"}, + {file = "caio-0.9.12-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:18df0caecfaa90ab9ac84ff71975fcf2342554b6f65ef69049337204b8b5af42"}, + {file = "caio-0.9.12-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e569b83e9b41d12e094190d0e1a546610829a65609f429a1845e3250d4c5804"}, + {file = "caio-0.9.12-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7833f81f58e76a3585ff59813e63fa278731c8d26fefe52ae12e783d38c8faea"}, + {file = "caio-0.9.12-cp37-cp37m-macosx_10_15_x86_64.whl", hash = "sha256:aa1dab77aca0b2672b9a364f14a03e764c5d811c0ae1395f661a2b8f6723f958"}, + {file = "caio-0.9.12-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:f366c595eda130a184f372d458d647b0ac879a46e872757648d4e29b6cea12ad"}, + {file = "caio-0.9.12-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2759fe1957d0effb3bc38b3508b20fa37610bff9005f3926f570e6c06e901567"}, + {file = "caio-0.9.12-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9e65060717e27c702cd76a90be33250cae46be32a3009781ce382c8675fa7551"}, + {file = "caio-0.9.12-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:a8204c6a7ea3c96057abba3da1690190b3cae0c3f03d81e9b5e3c99978b5bb6e"}, + {file = "caio-0.9.12-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:820bb3ef23ce0d4096f822a8fea97ff2c239dd0351fa588801d2de627df9ab98"}, + {file = "caio-0.9.12-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa9a27973a03c777934decd577be577a61a188bee72272b3dc37a7cbc5eedf91"}, + {file = "caio-0.9.12-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3d6b424644ac37ce84f9dd99757d29e7cff01018d3b31f8ec0a38f2d5216165c"}, + {file = "caio-0.9.12-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:15192a28e054cd591489af82f4b1093f15338eb201a2399a337461ff0bbd9fc9"}, + {file = "caio-0.9.12-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:55317d2c90479a58108cfbd6816b85e584e61c48b42269c55f69cf4443857068"}, + {file = "caio-0.9.12-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b18318d04cad7ef985fc2fb86d43f866ba34c1ee3445385f2370d6f843c05c69"}, + {file = "caio-0.9.12-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:73c20d8fc7dfb140b7d57e69e6f17e1637d2ac4a9ebe0f5f8c94b56f87c5c087"}, + {file = "caio-0.9.12-py3-none-any.whl", hash = "sha256:b81b3271478e91f18e7ac1f3e4f914ba0924364857ba8e27f03b9d0aea915ca8"}, + {file = "caio-0.9.12.tar.gz", hash = "sha256:d2be553738dd793f8a01a60316f2c5284fbf152219241c0c67ca05f650a37a37"}, +] + +[package.extras] +develop = ["aiomisc-pytest", "pytest", "pytest-cov"] + +[[package]] +name = "certifi" +version = "2022.12.7" +description = "Python package for providing Mozilla's CA Bundle." +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "certifi-2022.12.7-py3-none-any.whl", hash = "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"}, + {file = "certifi-2022.12.7.tar.gz", hash = "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3"}, +] + [[package]] name = "charset-normalizer" version = "2.1.1" @@ -278,6 +391,23 @@ files = [ [package.dependencies] Pillow = "*" +[[package]] +name = "craiyon-py" +version = "0.3.0" +description = "API Wrapper for craiyon.com (DAL-E-MINI). Generate awesome images from text tokens." +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "craiyon.py-0.3.0.tar.gz", hash = "sha256:fb54c64006ed8496dbe136668f2e32ace53a2f32a824b2968cb6ab67f4efc342"}, +] + +[package.dependencies] +aiofiles = "*" +aiohttp = "*" +aiopath = "*" +requests = "*" + [[package]] name = "discord-py" version = "2.1.0" @@ -627,6 +757,13 @@ files = [ {file = "Pillow-9.4.0-1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:b8c2f6eb0df979ee99433d8b3f6d193d9590f735cf12274c108bd954e30ca858"}, {file = "Pillow-9.4.0-1-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:b70756ec9417c34e097f987b4d8c510975216ad26ba6e57ccb53bc758f490dab"}, {file = "Pillow-9.4.0-1-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:43521ce2c4b865d385e78579a082b6ad1166ebed2b1a2293c3be1d68dd7ca3b9"}, + {file = "Pillow-9.4.0-2-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:9d9a62576b68cd90f7075876f4e8444487db5eeea0e4df3ba298ee38a8d067b0"}, + {file = "Pillow-9.4.0-2-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:87708d78a14d56a990fbf4f9cb350b7d89ee8988705e58e39bdf4d82c149210f"}, + {file = "Pillow-9.4.0-2-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:8a2b5874d17e72dfb80d917213abd55d7e1ed2479f38f001f264f7ce7bae757c"}, + {file = "Pillow-9.4.0-2-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:83125753a60cfc8c412de5896d10a0a405e0bd88d0470ad82e0869ddf0cb3848"}, + {file = "Pillow-9.4.0-2-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:9e5f94742033898bfe84c93c831a6f552bb629448d4072dd312306bab3bd96f1"}, + {file = "Pillow-9.4.0-2-pp38-pypy38_pp73-macosx_10_10_x86_64.whl", hash = "sha256:013016af6b3a12a2f40b704677f8b51f72cb007dac785a9933d5c86a72a7fe33"}, + {file = "Pillow-9.4.0-2-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:99d92d148dd03fd19d16175b6d355cc1b01faf80dae93c6c3eb4163709edc0a9"}, {file = "Pillow-9.4.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:2968c58feca624bb6c8502f9564dd187d0e1389964898f5e9e1fbc8533169157"}, {file = "Pillow-9.4.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c5c1362c14aee73f50143d74389b2c158707b4abce2cb055b7ad37ce60738d47"}, {file = "Pillow-9.4.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bd752c5ff1b4a870b7661234694f24b1d2b9076b8bf337321a814c612665f343"}, @@ -758,6 +895,28 @@ files = [ [package.extras] cli = ["click (>=5.0)"] +[[package]] +name = "requests" +version = "2.28.2" +description = "Python HTTP for Humans." +category = "main" +optional = false +python-versions = ">=3.7, <4" +files = [ + {file = "requests-2.28.2-py3-none-any.whl", hash = "sha256:64299f4909223da747622c030b781c0d7811e359c37124b4bd368fb8c6518baa"}, + {file = "requests-2.28.2.tar.gz", hash = "sha256:98b1b2782e3c6c4904938b84c0eb932721069dfdb9134313beff7c83c2df24bf"}, +] + +[package.dependencies] +certifi = ">=2017.4.17" +charset-normalizer = ">=2,<4" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<1.27" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] + [[package]] name = "rich" version = "13.3.1" @@ -777,6 +936,18 @@ pygments = ">=2.14.0,<3.0.0" [package.extras] jupyter = ["ipywidgets (>=7.5.1,<9)"] +[[package]] +name = "sniffio" +version = "1.3.0" +description = "Sniff out which async library your code is running under" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "sniffio-1.3.0-py3-none-any.whl", hash = "sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384"}, + {file = "sniffio-1.3.0.tar.gz", hash = "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101"}, +] + [[package]] name = "tomli" version = "2.0.1" @@ -789,6 +960,23 @@ files = [ {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] +[[package]] +name = "urllib3" +version = "1.26.15" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*" +files = [ + {file = "urllib3-1.26.15-py2.py3-none-any.whl", hash = "sha256:aa751d169e23c7479ce47a0cb0da579e3ede798f994f5816a74e4f4500dcea42"}, + {file = "urllib3-1.26.15.tar.gz", hash = "sha256:8a388717b9476f934a21484e8c8e61875ab60644d29b9b39e11e4b9dc1c6b305"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"] +secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)", "urllib3-secure-extra"] +socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] + [[package]] name = "yarl" version = "1.8.2" @@ -880,4 +1068,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "a1b0743e2b1263cc85da1f23a22631effaa4754923ba1db29707e4d331e0200c" +content-hash = "a923558434ba64afaa7a92f6128e8ea0400fbf6182b15f5ba216ce3028a735ae" diff --git a/pyproject.toml b/pyproject.toml index 65367e8..678cfc9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,6 +17,7 @@ aiohttp = "^3.8.3" colorthief = "0.2.1" orjson = "^3.8.5" aiomysql = "^0.1.1" +craiyon-py = "^0.3.0" [tool.poetry.group.dev.dependencies] black = "^22.12.0" diff --git a/requirements.txt b/requirements.txt index 6ca2c32..aa508c4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,18 @@ +aiofile==3.8.5 ; python_version >= "3.10" and python_version < "4" +aiofiles==23.1.0 ; python_version >= "3.10" and python_version < "4.0" aiohttp==3.8.3 ; python_version >= "3.10" and python_version < "4.0" aiomysql==0.1.1 ; python_version >= "3.10" and python_version < "4.0" +aiopath==0.6.11 ; python_version >= "3.10" and python_version < "4.0" aiosignal==1.3.1 ; python_version >= "3.10" and python_version < "4.0" aiosqlite==0.18.0 ; python_version >= "3.10" and python_version < "4.0" +anyio==3.6.2 ; python_version >= "3.10" and python_version < "4.0" async-timeout==4.0.2 ; python_version >= "3.10" and python_version < "4.0" attrs==22.2.0 ; python_version >= "3.10" and python_version < "4.0" +caio==0.9.12 ; python_version >= "3.10" and python_version < "4" +certifi==2022.12.7 ; python_version >= "3.10" and python_version < "4" charset-normalizer==2.1.1 ; python_version >= "3.10" and python_version < "4.0" colorthief==0.2.1 ; python_version >= "3.10" and python_version < "4.0" +craiyon-py==0.3.0 ; python_version >= "3.10" and python_version < "4.0" discord-py==2.1.0 ; python_version >= "3.10" and python_version < "4.0" frozenlist==1.3.3 ; python_version >= "3.10" and python_version < "4.0" idna==3.4 ; python_version >= "3.10" and python_version < "4.0" @@ -17,5 +24,8 @@ pillow==9.4.0 ; python_version >= "3.10" and python_version < "4.0" pygments==2.14.0 ; python_version >= "3.10" and python_version < "4.0" pymysql==1.0.2 ; python_version >= "3.10" and python_version < "4.0" python-dotenv==0.21.0 ; python_version >= "3.10" and python_version < "4.0" +requests==2.28.2 ; python_version >= "3.10" and python_version < "4" rich==13.3.1 ; python_version >= "3.10" and python_version < "4.0" +sniffio==1.3.0 ; python_version >= "3.10" and python_version < "4.0" +urllib3==1.26.15 ; python_version >= "3.10" and python_version < "4" yarl==1.8.2 ; python_version >= "3.10" and python_version < "4.0" From 6a46fffd05c6064ba83ca5ed5b29ed879cc831f5 Mon Sep 17 00:00:00 2001 From: Code beautifier Date: Thu, 6 Apr 2023 06:25:42 +0000 Subject: [PATCH 13/13] Beautified --- bot/commands/fun/gen.py | 25 +++++++++++++++-------- bot/commands/utility/__blocked_prompts.py | 3 +-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/bot/commands/fun/gen.py b/bot/commands/fun/gen.py index 3e9cc23..dd57b32 100644 --- a/bot/commands/fun/gen.py +++ b/bot/commands/fun/gen.py @@ -1,15 +1,18 @@ -from io import BytesIO import base64 import time +from io import BytesIO + from craiyon import Craiyon + +from bot.base import Command from bot.commands.utility.__blocked_prompts import blocked from bot.config import Config, Embed -from bot.base import Command class cmd(Command): - """ A discord command instance. """ -# + """A discord command instance.""" + + # name = "gen" usage = "gen <*prompt>" description = "Uses the Craiyon AI API to generate an image with a given prompt" @@ -18,17 +21,21 @@ async def execute(self, arguments, message) -> None: prompt = arguments[0] for word in prompt.split(): if word.lower() in blocked: - await message.channel.send("I'm not generating that you meanie >:( It's NSFW! Try something else!") + await message.channel.send( + "I'm not generating that you meanie >:( It's NSFW! Try something else!" + ) return - - loadingE = Embed(title=f"Image '{prompt}' currently generating, please wait a moment!") + + loadingE = Embed( + title=f"Image '{prompt}' currently generating, please wait a moment!" + ) loadingM = await message.channel.send(embed=loadingE) - + generator = Craiyon() result = generator.generate(prompt) images = result.images embed = Embed(title="Here is the generated image") embed.set_image(url=images[0]) - + await loadingM.delete() await message.channel.send(embed=embed) diff --git a/bot/commands/utility/__blocked_prompts.py b/bot/commands/utility/__blocked_prompts.py index 61220fc..c7c3fe7 100644 --- a/bot/commands/utility/__blocked_prompts.py +++ b/bot/commands/utility/__blocked_prompts.py @@ -20,6 +20,5 @@ "anal", "vaginal", "erotic", - "notepad" - + "notepad", ]