Migrating from NAFF¶
Oh hey! So you're migrating from NAFF to interactions.py? Well lets get you sorted.
First and foremost, you'll need to install the new library. You can do this by running pip install interactions.py
in your terminal. Then, the first thing you'll need to do is change your imports. You'll need to change from naff import _
to from interactions import _
. To be honest, assuming your code is relatively simple, you should be able to use find and replace to do this.
Prefixed Commands¶
I.py moves prefixed commands to an extension, rather than being a part of the client. So to use them you'll need to load them.
1 2 3 4 5 6 7 8 |
|
Hybrid Commands¶
For now, hybrid commands are not supported, but they will be in the future.
Enums¶
To get us on the same page. Enums are a way of defining a set of constants. For a Discord example, ButtonStyles. In v5, enums are no longer plural. So ButtonStyles
is now ButtonStyle
. This applies to all enums in the library.
StringSelectMenu¶
StringSelectMenu
now takes it's options as positional arguments, rather than a list. This means that you can no longer do StringSelectMenu(options=[...])
, instead the quickest way to do it is StringSelectMenu(*[...])
. Alternatively, I recommend this syntax:
1 2 3 4 |
|
Modals¶
Much like StringSelectMenu
, Modals now take their children as positional arguments, rather than a list. This means that you can no longer do Modal(components=[...])
, instead the quickest way to do it is Modal(*[...])
. Again, the same recommendation applies here:
1 2 3 4 5 |
|
Kwargs Vs. Args¶
V5 prefers kwargs over args. This means for the majority of methods and objects, they expect their arguments to be passed as kwargs, rather than args. This is to make the library more readable, and to make it easier to add new arguments in the future. The only exceptions to this are list-like objects, like ActionRow
, StringSelectMenu
, Modal
, where the children are passed as args in order to keep the syntax clean.