I’ve just started learning python and wanted to make a discord bot hoping to learn some coding on the way. Right now im trying to make a chatbot and im facing an issue.
from prsaw import RandomStuff
rs = RandomStuff(async_mode = True)
Code:
@client.event
async def on_message(message):
if client.user == message.author:
return
if message.channel.id == 833292700744548392:
response = await rs.get_ai_response(message.content)
await message.reply(response)
await client.process_commands(message)
Error message:
Traceback (most recent call last):
File "C:\Users\Johaa\PycharmProjects\Kushina 2.0\main.py", line 16, in <module>
rs = RandomStuff(async_mode = True)
TypeError: __init__() missing 1 required positional argument: 'api_key'
I’m not sure how to get an ‘api key’ or what it is
video – https://www.youtube.com/watch?v=xKfaobGpKlQ
>Solution :
It looks like you need to pass api_key to RandomStuff. So instead of this:
rs = RandomStuff(async_mode = True)
Try this:
rs = RandomStuff(async_mode = True, api_key = api_key)
Here’s how to get an api key. An API Key gives you access to use the API.