Skip to content

Conversation

AstreaTSS
Copy link
Member

@AstreaTSS AstreaTSS commented Aug 13, 2025

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

#1778 mentions an interesting bug that came up because of a bug fix from aiohttp. This is because, when a session closes, aiohttp will now dispatch a close event rather than abruptly ending. Our code was not expecting this possibility, and so when handling a pre-established edge case, it errored out.

This PR fixes any errors that come from such a behavior.

Changes

  • Add a new closed attribute to HTTPClient.
  • Make WebsocketClient send an internal "no-op" op code if the websocket receives a CLOSED even and the HTTP client is closed.
    • Closing is already handled by other means later in the code. We have no need to implement actual behavior.
    • The internal op code may be controversial, but we should never get it under normal circumstances anyways.
  • Make the no-op op code make GatewayClient simply ignore it.

Related Issues

Closes #1778.

Test Scenarios

# Ensure aiohttp>=3.12.4
from interactions import Client
bot = Client()
bot.start("token") # Ctrl+C when running

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants