Migrating to v2

Deprecation of InteractionsApp.start()

The start() method is being removed in favor of aiohttp’s asynchronous start methods. The reason behind this is the start() method uses aiohttp.web._run_app() which is a private method so it’s best to move away from using undocumented methods.

import asyncio

import aiointeractions
from aiohttp import web

client = discord.Client(...)
app = aiointeractions.InteractionsApp(client, ...)

async def main():
    async with client:
        await app.start('token')

asyncio.run(main())

Addition of InteractionsApp.setup()

This new method logs in the discord client and fetches verification keys. This method is automatically called in InteractionsApp.run() so only use it if you are using alternative start methods such as the method above.

Removal of the raise_for_bad_response parameter for InteractionsApp

Now aiohttp.web.HTTPUnauthorized will always be raised for invalid authentication.

Rename InteractionsApp.app to aiohttp_app

Both the parameter app for the constructor of InteractionsApp and the attribute app have been renamed to aiohttp_app. The goal of this is to add distinction in scenarios such as this.

app = aiointeractions.InteractionsApp()
print('The aiohttp app is', app.app)
                            ^^^^^^^

Other changes to InteractionsApp

  • The discord client login and the fetching of the verification keys from InteractionsApp.setup() now are called after the web server is started, instead of before.