Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I have a slight issue with my code and im not sure

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:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading