Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Kav-K/GPT3Discord
Browse files Browse the repository at this point in the history
  • Loading branch information
Kav-K committed Dec 31, 2022
2 parents 60bda11 + 2149b07 commit 39e8a61
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 96 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish to PyPI

on:
release:
types: [published]

permissions:
contents: read

jobs:
main:
name: sdist + pure wheel
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up latest Python
uses: actions/setup-python@v4
with:
python-version: "*"

- name: Install latest pip, build, twine
run: |
python -m pip install --upgrade --disable-pip-version-check pip
python -m pip install --upgrade build twine
- name: Build wheel and source distributions
run: python -m build

- name: Upload to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload --verbose -u '__token__' dist/*
34 changes: 23 additions & 11 deletions cogs/draw_image_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,21 @@ async def encapsulated_send(

if not response_message: # Original generation case
# Start an interaction with the user, we also want to send data embed=embed, file=file, view=SaveView(image_urls, self, self.converser_cog)
result_message = await ctx.channel.send(
embed=embed,
file=file,
) if not from_context else await ctx.respond(embed=embed, file=file)
result_message = (
await ctx.channel.send(
embed=embed,
file=file,
)
if not from_context
else await ctx.respond(embed=embed, file=file)
)

await result_message.edit(
view=SaveView(image_urls, self, self.converser_cog, result_message)
)

self.converser_cog.users_to_interactions[user_id] = []
self.converser_cog.users_to_interactions[user_id].append(
result_message.id
)
self.converser_cog.users_to_interactions[user_id].append(result_message.id)

# Get the actual result message object
if from_context:
Expand Down Expand Up @@ -128,8 +130,10 @@ async def encapsulated_send(
result_message.id
)

@discord.slash_command(name="draw", description="Draw an image from a prompt", guild_ids=ALLOWED_GUILDS)
@discord.option(name = "prompt", description = "The prompt to draw from", required = True)
@discord.slash_command(
name="draw", description="Draw an image from a prompt", guild_ids=ALLOWED_GUILDS
)
@discord.option(name="prompt", description="The prompt to draw from", required=True)
async def draw(self, ctx: discord.ApplicationContext, prompt: str):
await ctx.defer()

Expand All @@ -151,7 +155,11 @@ async def draw(self, ctx: discord.ApplicationContext, prompt: str):
await ctx.respond("Something went wrong. Please try again later.")
await ctx.send_followup(e)

@discord.slash_command(name="local-size", description="Get the size of the dall-e images folder that we have on the current system", guild_ids=ALLOWED_GUILDS)
@discord.slash_command(
name="local-size",
description="Get the size of the dall-e images folder that we have on the current system",
guild_ids=ALLOWED_GUILDS,
)
@discord.guild_only()
async def local_size(self, ctx: discord.ApplicationContext):
await ctx.defer()
Expand All @@ -171,7 +179,11 @@ async def local_size(self, ctx: discord.ApplicationContext):
total_size = total_size / 1000000
await ctx.respond(f"The size of the local images folder is {total_size} MB.")

@discord.slash_command(name="clear-local", description="Clear the local dalleimages folder on system.", guild_ids=ALLOWED_GUILDS)
@discord.slash_command(
name="clear-local",
description="Clear the local dalleimages folder on system.",
guild_ids=ALLOWED_GUILDS,
)
@discord.guild_only()
async def clear_local(self, ctx):
await ctx.defer()
Expand Down
Loading

0 comments on commit 39e8a61

Please sign in to comment.