Module Not Found Error - Nix upgrade issue?

Hello, I just opened one of my Discord Chat bots to make some changes, but clicking it did some upgrade to ‘Nix’.

Suddenly, my bot will no longer run as I keep getting the following error:

Traceback (most recent call last):
  File "", line 3, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'

Which is simply the line:

import discord

It’s been a long time since I worked on these bots and don’t quite remember their set up.
Has something changed recently? Do I now need something new to work with Nix?

While it shouldn’t have broken, you should be able to fix it by going into the Shell tab and running pip install discord.


How curious! Thanks you, the install worked, though now a have a follow up error of:

Traceback (most recent call last):
  File "", line 9, in <module>
    client = commands.Bot(command_prefix = 'a!')
TypeError: __init__() missing 1 required keyword-only argument: 'intents'

Could this be that the newest version of Discord import has changed how this code works?

Yes! This is exactly why you get this error. In recent updates, discord made it so it can more efficiently send data by using intents (limit data to only what you need for your bot). in a recent update also made changes to enforce this, so and code that is >1 year old will need to be changed to accommodate this.

This link might help you: Migrating to v2.0


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.