Spaces:
Running
Running
seawolf2357
commited on
Commit
โข
440418c
1
Parent(s):
08baccf
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,28 @@
|
|
1 |
import discord
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
class MyClient(discord.Client):
|
7 |
def __init__(self, *args, **kwargs):
|
8 |
super().__init__(*args, **kwargs)
|
9 |
|
10 |
async def on_ready(self):
|
11 |
-
|
12 |
|
13 |
async def on_message(self, message):
|
14 |
if message.author == self.user:
|
|
|
15 |
return
|
16 |
response = message.content + " hello"
|
|
|
17 |
await message.channel.send(response)
|
18 |
|
19 |
# ๋ด ๊ฐ์ฒด ์์ฑ ๋ฐ ์คํ
|
|
|
1 |
import discord
|
2 |
+
import logging
|
3 |
|
4 |
+
# ๋ก๊น
์ค์
|
5 |
+
logging.basicConfig(level=logging.DEBUG,
|
6 |
+
format='%(asctime)s:%(levelname)s:%(name)s: %(message)s',
|
7 |
+
handlers=[logging.StreamHandler()]) # ๋ก๊ทธ๋ฅผ ์ฝ์์ ์ถ๋ ฅ
|
8 |
+
|
9 |
+
# Intents ์์ฑ
|
10 |
+
intents = discord.Intents.default()
|
11 |
+
intents.messages = True
|
12 |
|
13 |
class MyClient(discord.Client):
|
14 |
def __init__(self, *args, **kwargs):
|
15 |
super().__init__(*args, **kwargs)
|
16 |
|
17 |
async def on_ready(self):
|
18 |
+
logging.info(f'Logged on as {self.user}!')
|
19 |
|
20 |
async def on_message(self, message):
|
21 |
if message.author == self.user:
|
22 |
+
logging.info('Ignoring message from self.')
|
23 |
return
|
24 |
response = message.content + " hello"
|
25 |
+
logging.debug(f'Responding to message: {message.content}')
|
26 |
await message.channel.send(response)
|
27 |
|
28 |
# ๋ด ๊ฐ์ฒด ์์ฑ ๋ฐ ์คํ
|