-
Notifications
You must be signed in to change notification settings - Fork 6
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
Move invite URL generation to on_ready
event
#166
Comments
I'd like to take this issue on. Is there any helpful files/lines of code I should start looking at for this issue? |
Hi @edwinchan129! We really appreciate you looking to contribute to TeX-Bot. The main changes for this issue would be to:
I have added links to all the necessary code lines/documentation but feel free to look around any of the existing code to see how we have used the invite URL generation code so far. And keep asking questions if you ever get stuck or need any additional help! |
@CarrotManMatt Do you mean that the bot should output a link when this command "poetry run python -m main" is run instead and generate an invite link based on variables set on the .env file? I'm also unsure on how to get Tex-Bot to run properly in my test server as I'm unsure what to put into the required variables: MEMBERS_LIST_URL, MEMBERS_LIST_URL_SESSION_COOKIE, and MODERATION_DOCUMENT_URL. |
In a sense. If you call the
Retrieving the main guild is already done within the
Apologies about this. The current state of the project makes these variables required, however they should be optional when running locally. They are used only for the
See the |
Alright I got the basics of it down and it seems to be working at generating an invite url. I just want to ask some more clarifying questions before I test it further and the submit a pull request.
Does this mean that the the invite url should be generated each time the bot is run, but the bot should exit out if the user doesn't invite the bot to the guild specified in the .env file? I see in the startup.py that there is a check for whether the bot has a main_guild set, but this itself doesn't verify whether the bot is already in the server before proceeding. It does, however, shut down if the main_guild isn't set. Should this be modified to the case I mentioned or is simply generating a valid invite url at the moment all that matters? |
Good thoughts! I would suggest that if the bot is already in the selected guild, then the invite URL should only be outputted if the log level is set to If the bot is not yet in the selected guild (hence main_guild does not get set because the guild is not within the list of guild that the bot is within) it should always output the invite URL and then shut down. |
Moved invite URL generation to global function within utils/generate_invite_url.py. Deleted utils/__main__.py and utils/base_utility_function.py. Removed main() from utils/init.py. Moved call to generate_invite_url() to startup.py. - If main guild not set, invite URL will be outputted and bot will be shutdown. - If main guild is set, invite URL will only be outputted if CONSOLE_LOG_LEVEL in environment variable set to DEBUG. I had to modify tests for generate_invite_url() in test/tests_util.py reflect new behavior as it no longer takes in command line arguments. - You may need to modify it accordingly to remove irrelevant test cases and adjust to new behavior.
Rather than generating the invite URL from a util CLI command, it should just be output when the bot is run.
If the selected guild (from the given ID) is not available to the bot, the bot should shut down. An error message should be alerted that the bot needs to be invited using the outputted invite URL link.
Completion of this issue should also include removing the whole of the CLI util command framework.
The text was updated successfully, but these errors were encountered: