Skip to content

feat: ability to define which shards connect #1602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

Wolfhound905
Copy link
Contributor

@Wolfhound905 Wolfhound905 commented Feb 12, 2024

Pull Request Type

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

Description

Having one AutoShardedClient can be risky in the case of a fatal error in a users code. Leading for the entire bot to crash. With this feature, a user can call a microservice or other to determine what shards the AutoShardedClient should be running.

Changes

  • added shard_ids to AutoShardedClient classs

Test Scenarios

bot = AutoShardedClient(
    fetch_members=False,
    delete_unused_application_cmds=False,
    sync_interactions=False,
    total_shards=112,
    shard_ids=[12, 13, 14, 15, 16],
    basic_logging=True,
    log_level=logging.DEBUG,
)


@listen(Startup, delay_until_ready=True)
async def on_startup(event: Startup):
    print("Bot is ready")
    print(f"Logged in as {bot.user}")
    print(f"Bot ID: {bot.user.id}")
    print(f"Guilds: {len(bot.guilds)}")

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

@AstreaTSS AstreaTSS merged commit 71d1385 into interactions-py:unstable Mar 1, 2024
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy