Even thought I initiated async ask, and I asked !ask (“How are you?’), it still gave the issue of command ask not found. Plz help
import discord
from discord.ext import commands
from gtts import gTTS
import asyncio
import os
from transformers import pipeline
intents = discord.Intents.default()
intents.typing = True
bot = commands.Bot(command_prefix='!', intents=intents)
generator = pipeline('text-generation', model='distilgpt2')
@bot.event
async def on_ready():
print(f'Logged in as {bot.user}')
async def ask(ctx, *, question):
response = generate_response(question)
await ctx.send(response)
def generate_response(prompt):
response = generator(prompt, max_length=100)[0]['generated_text']
return response
bot.run('MTI2MDI5NDEyMjY0NDgzMjI5Ng.GCQOG4.Y7kzCDwRdCm_pjAiu-zUqW8Lyu44_UtVGbewW0')
New contributor
Toxic-Jango -_- is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.