-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
60 lines (43 loc) · 1.9 KB
/
main.py
File metadata and controls
60 lines (43 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import os
import discord
import base64
from src.discordBot import DiscordClient, Sender
from src.server import keep_alive
import datetime
from module import food
from module import chatgpt as gpt
from module import elasticsearch_engine as ese
print("main.py 실행중")
file_path = "discord_api_key_base64.txt"
with open(file_path, 'r') as file:
# 파일 내용 읽기
encoded_content = file.read()
# base64 디코딩
decoded_content = base64.b64decode(encoded_content)
decoded_string = decoded_content.decode('utf-8')
def run():
client = DiscordClient()
sender = Sender()
@client.tree.command(name="chat", description="Have a chat with ChatGPT")
async def chat(interaction: discord.Interaction, *, message: str):
user_id = interaction.user.id
if interaction.user == client.user:
return
await interaction.response.defer()
receive = gpt.chat(message)
await sender.send_message(interaction, message, receive)
@client.tree.command(name='기숙사',description='기숙사 메뉴을 알 수 있습니다(푸름, 오름1, 오름3, 분식당, 교직원식당, 학생식당)')
async def menu(interaction: discord.Integration,이름 : str):
embed = discord.Embed(title = '😝오늘의 식단😝', description = food.get_menu_data(이름), colour=0x3498DB)
await interaction.response.send_message(embed = embed)
@client.tree.command(name="ping", description="Ping!")
async def ping(interaction: discord.Interaction):
await interaction.response.send_message("Pong!")
@client.tree.command(name='메롱',description='😝')
async def wow(interaction : discord.Integration):
embed = discord.Embed(title='😝',description='😝',colour=0x3498DB)
await interaction.response.send_message(embed = embed)
client.run(decoded_string)
if __name__ == '__main__':
keep_alive()
run()