Skip to content
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

feat: add reconnectivity module; refactor: add presenceUpdaterHandler… #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

StelluR
Copy link
Collaborator

@StelluR StelluR commented Sep 23, 2024

… module

Problem:
In its current state, the role bot will throw a timeout error if the
host server loses internet for an extended period of time. It may also go into
a freezed-state where no further discord API calls take place even after the internet
has returned.

Using a process manager to automatically restart the bot in an errored-state does not
help solve this issue, since there is no way to handle connection errors upon
attempting to log into the bot itself.

Further, the code in bot.js is quite disorganized and not easy to follow.

Solution:
Check internet connection upon bot startup and only attempt to login if
the ipv4 connection is OK. Otherwise, continue attempting to connect
in 30-second intervals for when the ipv4 connection returns. These features
have been incorporated into the new reconnect.js file.

Further, update README.md to incorporate instructions for optionally using the
pm2 process manager to automatically restart the bot when in an errored state or during
times of unexpected host server reboot. This helps prevent unnecessary manual intervention.

Further, separate out the presence updating code into its own separate presenceUpdateHandler file
for the sake of readability.

… module

Problem:
    In its current state, the role bot will throw a timeout error if the
    host server loses internet for an extended period of time. It may also go into
    a freezed-state where no further discord API calls take place even after the internet
    has returned.

    Using a process manager to automatically restart the bot in an errored-state does not
    help solve this issue, since there is no way to handle connection errors upon
    attempting to log into the bot itself.

    Further, the code in bot.js is quite disorganized and not easy to follow.

Solution:
    Check internet connection upon bot startup and only attempt to login if
    the ipv4 connection is OK. Otherwise, continue attempting to connect
    in 30-second intervals for when the ipv4 connection returns. These features
    have been incorporated into the new reconnect.js file.

    Further, update README.md to incorporate instructions for optionally using the
    pm2 process manager to automatically restart the bot when in an errored state or during
    times of unexpected host server reboot. This helps prevent unnecessary manual intervention.

    Further, separate out the presence updating code into its own separate presenceUpdateHandler file
    for the sake of readability.
@StelluR StelluR requested a review from shayaantx September 23, 2024 17:51
Copy link
Owner

@shayaantx shayaantx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea what im approving, but go ahead

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