govisi's picture
Update app.py
a509010
raw
history blame
898 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.all())
# model_pipe = pickle.load(open('pipe.pkl', 'rb'))
@bot.event
async def on_ready():
print(f'We have logged in as {bot.user}')
@bot.listen('on_message')
async def on_message_event(message):
if message.author == bot.user:
return
if message.content:
print(message.content)
# await message.channel.send(model_pipe.predict([message.content]))
await message.channel.send('Hello from hugging face')
# await bot.process_commands(message)
bot.env = "prod" # type: ignore
bot.name = "testAniPin" # type: ignore
t = Thread(target=bot.run, daemon=True, args=(os.getenv("discord_token"), ))
# bot.run(os.getenv("discord_token"))
t.start()