Spaces:
Runtime error
Runtime error
File size: 894 Bytes
9a5ae39 f7082fd 9a5ae39 f7082fd 9a5ae39 f7082fd 9a5ae39 f7082fd 9a5ae39 f7082fd 9a5ae39 f7082fd 9a5ae39 |
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 |
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'))
@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')
t = Thread(target=bot.run, daemon=True, args=(os.getenv("discord_token"), ))
t.start()
|