|
import requests |
|
import json |
|
import pandas as pd |
|
import os |
|
import pyarrow.parquet as pq |
|
import discord |
|
|
|
|
|
discordtoken = "MI2Mk0zQ3czc0Mz4Mw.Glf6.2bSeer-q5jHVnClSe1wsP0IHpVyIdxGaYac" |
|
discordchannelid = 1261896610506604564 |
|
|
|
|
|
client = discord.Client() |
|
|
|
def respondtodiscord(message): |
|
|
|
url = f"https://discord.com/api/v9/channels/{discordchannelid}/messages" |
|
|
|
|
|
data = { |
|
"content": message |
|
} |
|
|
|
|
|
headers = { |
|
"Authorization": discordtoken |
|
} |
|
|
|
try: |
|
|
|
response = requests.post(url, headers=headers, json=data) |
|
|
|
if response.statuscode == 200: |
|
print("λ©μμ§ μ μ‘ μ±κ³΅") |
|
else: |
|
print(f"λ©μμ§ μ μ‘ μ€ν¨: {response.statuscode}") |
|
|
|
except Exception as e: |
|
print(f"μκΈ°μΉ λͺ»ν μ€λ₯κ° λ°μνμ΅λλ€: {str(e)}") |
|
|
|
def getanswer(question): |
|
matchinganswer = df[df['question'] == question]['answer'].values |
|
return matching |