Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -40,71 +40,6 @@ WEBHOOK_URL = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjUwNTY1M
|
|
40 |
# μ μ‘ μ€ν¨ μ μ¬μλ νμ
|
41 |
MAX_RETRIES = 3
|
42 |
|
43 |
-
class MyClient(discord.Client):
|
44 |
-
def __init__(self, *args, **kwargs):
|
45 |
-
super().__init__(*args, **kwargs)
|
46 |
-
self.is_processing = False
|
47 |
-
self.session = None
|
48 |
-
|
49 |
-
async def on_ready(self):
|
50 |
-
logging.info(f'{self.user}λ‘ λ‘κ·ΈμΈλμμ΅λλ€!')
|
51 |
-
|
52 |
-
# web.py νμΌ μ€ν
|
53 |
-
subprocess.Popen(["python", "web.py"])
|
54 |
-
logging.info("Web.py μλ²κ° μμλμμ΅λλ€.")
|
55 |
-
|
56 |
-
# aiohttp ν΄λΌμ΄μΈνΈ μΈμ
μμ±
|
57 |
-
self.session = aiohttp.ClientSession()
|
58 |
-
|
59 |
-
# λ΄μ΄ μμλ λ μλ΄ λ©μμ§λ₯Ό μ μ‘
|
60 |
-
channel = self.get_channel(SPECIFIC_CHANNEL_ID)
|
61 |
-
if channel:
|
62 |
-
await channel.send("μ νλΈ λΉλμ€ URLμ μ
λ ₯νλ©΄, μλ§κ³Ό λκΈμ κΈ°λ°μΌλ‘ λ΅κΈμ μμ±ν©λλ€.")
|
63 |
-
|
64 |
-
async def on_message(self, message):
|
65 |
-
if message.author == self.user:
|
66 |
-
returnimport discord
|
67 |
-
import logging
|
68 |
-
import os
|
69 |
-
import re
|
70 |
-
import asyncio
|
71 |
-
import subprocess
|
72 |
-
import aiohttp
|
73 |
-
from huggingface_hub import InferenceClient
|
74 |
-
from googleapiclient.discovery import build
|
75 |
-
from youtube_transcript_api import YouTubeTranscriptApi
|
76 |
-
from youtube_transcript_api.formatters import TextFormatter
|
77 |
-
from dotenv import load_dotenv
|
78 |
-
|
79 |
-
# νκ²½ λ³μ λ‘λ
|
80 |
-
load_dotenv()
|
81 |
-
|
82 |
-
# λ‘κΉ
μ€μ
|
83 |
-
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s:%(message)s', handlers=[logging.StreamHandler()])
|
84 |
-
|
85 |
-
# μΈν
νΈ μ€μ
|
86 |
-
intents = discord.Intents.default()
|
87 |
-
intents.message_content = True
|
88 |
-
intents.messages = True
|
89 |
-
intents.guilds = True
|
90 |
-
intents.guild_messages = True
|
91 |
-
|
92 |
-
# μΆλ‘ API ν΄λΌμ΄μΈνΈ μ€μ
|
93 |
-
hf_client = InferenceClient("CohereForAI/c4ai-command-r-plus", token=os.getenv("HF_TOKEN"))
|
94 |
-
|
95 |
-
# YouTube API μ€μ
|
96 |
-
API_KEY = os.getenv("YOUTUBE_API_KEY")
|
97 |
-
youtube_service = build('youtube', 'v3', developerKey=API_KEY)
|
98 |
-
|
99 |
-
# νΉμ μ±λ ID
|
100 |
-
SPECIFIC_CHANNEL_ID = int(os.getenv("DISCORD_CHANNEL_ID"))
|
101 |
-
|
102 |
-
# μΉν
URL μ€μ
|
103 |
-
WEBHOOK_URL = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjUwNTY1MDYzMjA0MzA1MjY4NTUzMDUxMzUi_pc"
|
104 |
-
|
105 |
-
# μ μ‘ μ€ν¨ μ μ¬μλ νμ
|
106 |
-
MAX_RETRIES = 3
|
107 |
-
|
108 |
class MyClient(discord.Client):
|
109 |
def __init__(self, *args, **kwargs):
|
110 |
super().__init__(*args, **kwargs)
|
|
|
40 |
# μ μ‘ μ€ν¨ μ μ¬μλ νμ
|
41 |
MAX_RETRIES = 3
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
class MyClient(discord.Client):
|
44 |
def __init__(self, *args, **kwargs):
|
45 |
super().__init__(*args, **kwargs)
|