Answer the question
In order to leave comments, you need to log in
Where to find the Dialogflow token?
I wanted to make my bots the function of communicating with the user thanks to the neural network, I decided to use Dialogflow. And I wrote this code:
import discord
from discord.ext import commands
from config import settings
import apiai, json
bot = commands.Bot(command_prefix = settings['prefix'])
@bot.command()
async def talk(ctx):
content = ctx.message.content.split()
request = apiai.ApiAI('Dialogflow_Token').text_request()
request.lang = 'en'
request.query = content
responseJson = json.loads(request.getresponse().read().decode('utf-8'))
response = responseJson
await ctx.send(response)
bot.run(settings['token'])
Answer the question
In order to leave comments, you need to log in
Dialogflow v2 no longer uses developer/client access tokens. This was only for v1.
To access API endpoints, you need to set up authentication and upload private keys.
If you are using a library, you should simply be able to make the downloaded keys available to your library. If you are doing it yourself, you will need to generate an OAuth 2 authentication token using these keys.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question