Update code: Changed description in ART.command

This commit is contained in:
tmddn3070 2023-12-06 00:12:54 +09:00
parent efdf6f0f24
commit 67cca95a68
6 changed files with 31 additions and 12 deletions

View File

@ -13,7 +13,7 @@ class CAiart(Cog):
ART = SlashCommandGroup("그림", "그림 기능") ART = SlashCommandGroup("그림", "그림 기능")
@ART.command(name="생성", description="루나가 그림을 그려줍니다.") @ART.command(name="생성", description="크돌이가 그림을 그려줍니다.")
@cooldown(1, 10, BucketType.user) @cooldown(1, 10, BucketType.user)
async def _생성(self, ctx, ress: Option(str, name="해상도",description="그림의 해상도를 입력해주세요. (기본값: 512x512)", required=False, choices=["1:1", "2:3", "7:4","3:4"], default="1:1"), async def _생성(self, ctx, ress: Option(str, name="해상도",description="그림의 해상도를 입력해주세요. (기본값: 512x512)", required=False, choices=["1:1", "2:3", "7:4","3:4"], default="1:1"),
shows: Option(str, name="보기여부",description="생성된 그림을 나를 제외한 사람한테 보여줄지 말지를 지정합니다.", choices=["보여주기","보여주지 말기"],required=False, default="보여주기"), shows: Option(str, name="보기여부",description="생성된 그림을 나를 제외한 사람한테 보여줄지 말지를 지정합니다.", choices=["보여주기","보여주지 말기"],required=False, default="보여주기"),

View File

@ -7,7 +7,7 @@ import onnxruntime as rt
from discord import ApplicationContext, DiscordException, Game, Guild from discord import ApplicationContext, DiscordException, Game, Guild
from discord.ext.commands import Cog from discord.ext.commands import Cog
from discord.ext import tasks from discord.ext import tasks
import sentry_sdk
from discord.ext.commands import CommandOnCooldown from discord.ext.commands import CommandOnCooldown
from Christmas.UI.Embed import Default_Embed, Music_Embed from Christmas.UI.Embed import Default_Embed, Music_Embed
from Christmas.config import ChristmasConfig from Christmas.config import ChristmasConfig
@ -25,7 +25,7 @@ class Event(Cog):
if isinstance(exception, CommandOnCooldown): if isinstance(exception, CommandOnCooldown):
await ctx.respond(Default_Embed.cooldown(exception.retry_after), ephemeral=True) await ctx.respond(Default_Embed.cooldown(exception.retry_after), ephemeral=True)
else: else:
print(exception) sentry_sdk.capture_exception(exception)
@Cog.listener() @Cog.listener()
async def on_ready(self) -> None: async def on_ready(self) -> None:
print("Ready!") print("Ready!")

View File

@ -87,15 +87,12 @@ class Aiart(Modal):
if re.search(r"\{[0-9]{18}\}", prompt): if re.search(r"\{[0-9]{18}\}", prompt):
user_id = re.search(r"\{[0-9]{18}\}", prompt).group()[1:-1] user_id = re.search(r"\{[0-9]{18}\}", prompt).group()[1:-1]
user = await interaction.guild.fetch_member(int(user_id)) user = await interaction.guild.fetch_member(int(user_id))
print(user)
if user == None: if user == None:
avatars = None avatars = None
else: else:
avatars = user.avatar avatars = user.avatar
print("OK")
config = ChristmasConfig() config = ChristmasConfig()
#prompt: str, remove: str, res: list, isnsfw: bool, style1: float, style2: float, afterprocess: float #prompt: str, remove: str, res: list, isnsfw: bool, style1: float, style2: float, afterprocess: float
print(avatars)
payload = await process_prompt(prompt, remove, self.res, self.allownsfw, self.style1, self.style2, self.afterprocess, avatars) payload = await process_prompt(prompt, remove, self.res, self.allownsfw, self.style1, self.style2, self.afterprocess, avatars)
config = ChristmasConfig() config = ChristmasConfig()
result = await post_gpu_server(f"{config.AI}/sdapi/v1/txt2img", payload) result = await post_gpu_server(f"{config.AI}/sdapi/v1/txt2img", payload)

View File

@ -1,3 +1,5 @@
import sentry_sdk
from types import SimpleNamespace from types import SimpleNamespace
from typing import Any, cast from typing import Any, cast

View File

@ -1,4 +1,9 @@
import os import os
import sentry_sdk
import asyncio
import logging
from sentry_sdk.integrations.asyncio import AsyncioIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from types import SimpleNamespace from types import SimpleNamespace
from typing import Any, cast from typing import Any, cast
@ -34,3 +39,19 @@ def apply_uvloop() -> None:
else: else:
uvloop.install() uvloop.install()
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
def inital_sentry_sdk() -> None:
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
sentry_logging = LoggingIntegration(
level=logging.WARNING,
event_level=logging.ERROR
)
sentry_sdk.init(
dsn="https://ddb20b81432c3da07a42f0da207f9cf0@o4506343770357760.ingest.sentry.io/4506343772258304",
integrations=[sentry_logging, AsyncioIntegration()]
)
print("inital sentry_sdk")

View File

@ -1,11 +1,10 @@
FROM python:3.11.5-slim FROM python:3.11.5-slim
WORKDIR /app WORKDIR /app
COPY requirements.txt . #COPY requirements.txt .
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
RUN pip install --no-cache-dir -r requirements.txt RUN pip install pandas py-cord koreanbots motor uvloop korcen nanoid pendulum Wavelink onnxruntime psutil meilisearch_python_sdk Pillow opencv-python aiogoogletrans sentry-sdk
RUN pip uninstall -y discord.py py-cord RUN pip uninstall -y discord.py py-cord
RUN pip install --no-cache-dir py-cord[speed] py-cord[voice] RUN pip install --no-cache-dir py-cord[speed] py-cord[voice]