govisi's picture
Update app.py
3ec1d01
raw
history blame
868 Bytes
import os, asyncio
# import pickle
import discord
from discord.ext import commands
from dotenv import load_dotenv
from threading import Thread
load_dotenv()
bot = commands.Bot("", intents=discord.Intents(messages=True))
# model_pipe = pickle.load(open('pipe.pkl', 'rb'))
@bot.event
async def on_ready():
print(f'We have logged in as {bot.user}')
@bot.event
async def on_message(message: discord.Message):
# if message.author == bot.user:
# return
if message.content and message.content.startswith('$hello'):
# print(message.content)
# await message.channel.send(model_pipe.predict([message.content]))
await message.channel.send('Hello from hugging face')
bot.env = "prod" # type: ignore
bot.name = "Anipins" # type: ignore
t = Thread(target=bot.run, daemon=True, args=(os.getenv("discord_token"), ))
t.start()