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

Make the src(source) command optionally available to users if the owner of the bot decides to #66

Open
Silverdimond opened this issue Apr 4, 2021 · 8 comments
Labels
enhancement New feature or request longterm A long-term plan that will take a while to deal with

Comments

@Silverdimond
Copy link

This could be for example used in open source bots like apple.py and etc.
If the code is already public why hide the command?

@4Kaylum
Copy link
Member

4Kaylum commented Apr 17, 2021

When we talked about this in the server I said that I could just check if the github attr was set in the config. Do you think that's a reasonable way to go about this? Otherwise I'd need a new field added in the database.

Another method I could go is to link to the repo's source code at the given line if it's not the owner calling the command (again using the github attr in the config) - this would prevent people using it to flood chat.

@Silverdimond
Copy link
Author

I think the link idea is a good one as it does prevent flooding and hides the code from people that should not be able to view it, i am not sure how the github attr works but you should be able to do the same with other git providers (ex. GitLab, BitBucket and etc.)

@4Kaylum
Copy link
Member

4Kaylum commented Apr 19, 2021

That's an interesting point. The attr is just a link to your repo in the config, but each different platform links to different lines in different ways. I hadn't considered that. I'd also need to guess the branch name. This throws a wrench in the works.

@Silverdimond
Copy link
Author

You do not need to guess the branch name as you could just check what is the active (current) branch using something like GitPython or you could check it manually by running git branch --show-current, as for the difference platforms have with links to different lines it should easy to check what platform it is and to use a dictionary with the ways they handle lines, files and branches and to just use string.format with something that looks like

linkways = {'github': 'https://github.com/{username}/{repo}/blob/{commitsha}/{filepath}#L{linenumber}',
'gitlab': 'https://gitlab.com/{username}/{repo}/-/blob/{commitsha}/{filepath}#L{linenumber}'}

i am not sure if thats exactly how it should look like but i think it should look similar to it.

@irismessage
Copy link
Contributor

He's right. Personally I would just check the HEAD file if it exists, and default to the default branch of the repo got from the api.

@4Kaylum
Copy link
Member

4Kaylum commented May 14, 2021

I'll do some testing and see what works. Thanks for the information.

@sn8to
Copy link
Contributor

sn8to commented Oct 6, 2021

Any updates on this?

@4Kaylum
Copy link
Member

4Kaylum commented Oct 13, 2021

Any updates on this?

Nothing I can show for it. I lost interest, really. If the bot's open source then it's open source. Feel free to PR it but I'm not going to add it.

@4Kaylum 4Kaylum added enhancement New feature or request longterm A long-term plan that will take a while to deal with labels Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request longterm A long-term plan that will take a while to deal with
Projects
None yet
Development

No branches or pull requests

4 participants