Spaces:
Runtime error
Runtime error
import os, asyncio | |
# import pickle | |
import discord | |
from discord.ext import commands | |
from threading import Thread | |
lock = asyncio.Lock() | |
bot = commands.Bot("", intents=discord.Intents(messages=True, guilds=True)) | |
intents = discord.Intents.default() | |
intents.message_content = True | |
client = discord.Client(intents=intents) | |
# model_pipe = pickle.load(open('pipe.pkl', 'rb')) | |
async def on_ready(): | |
print(f'We have logged in as {bot.user}') | |
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') | |
t = Thread(target=bot.run, daemon=True, args=(os.getenv("discord_token"), )) | |
t.start() | |