Skip to content

Gist auto filesharing in help threads #491

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

Merged
merged 20 commits into from
Aug 19, 2022
Merged

Gist auto filesharing in help threads #491

merged 20 commits into from
Aug 19, 2022

Conversation

SquidXTV
Copy link
Member

@SquidXTV SquidXTV commented Aug 12, 2022

Closes #489.

About

Automatically uploads files in help threads to gist and reply with the link to that gist.
It's easier to read files like that and longer files don't need to be downloaded.

image

ToDo:

  • proper API_KEY
  • multiple uploads to one gist

Config changes:

Added gistApiKey to config for file-sharing uploads to gist using GitHub's API.

How to create this key:

GitHub -> Settings -> Developer Settings -> Personal Access Token -> Create new token

you can choose note and expiration date yourself, and in scopes select gist:
image

after that copy your key and add it to your config.json
see also: Create GitHub personal access token

Release

Config changes, added the following:

"gistApiKey": "<your_gist_personal_access_token>"

@CLAassistant
Copy link

CLAassistant commented Aug 12, 2022

CLA assistant check
All committers have signed the CLA.

@Zabuzard
Copy link
Member

(could you also share some screenshots?)

@Zabuzard
Copy link
Member

Good job and thanks for the contribution, its an awesome feature 👍

@SquidXTV SquidXTV marked this pull request as ready for review August 13, 2022 23:27
@SquidXTV SquidXTV requested review from a team as code owners August 13, 2022 23:27
@Taz03
Copy link
Member

Taz03 commented Aug 14, 2022

whats up with the delete button?

@SquidXTV
Copy link
Member Author

SquidXTV commented Aug 14, 2022

whats up with the delete button?

look here:
https://discord.com/channels/272761734820003841/895717328359153664/1008150388534411344

Taz03
Taz03 previously approved these changes Aug 14, 2022
@Taz03 Taz03 requested a review from Zabuzard August 14, 2022 20:22
@Taz03
Copy link
Member

Taz03 commented Aug 15, 2022

what about adding a slash command /remove-gist messageId for now?

u need messageId to delete the message
also u need gistId to delete the gist

the messageId is provided in the command
after getting the messageId u can get the message by using MessageChannel.retrieveMessageById(messageId), after getting the Message u can use Message.getButtons() to get all the buttons on that message and from there u can get the Button(linking to the gist) use the Button.getUrl() method to get its url and u can get the id from that, then delete the gist

delete the message after that too if u want to or u can just disable the button, i prefer deleting the message(to keep the chat clutter free)

@SquidXTV
Copy link
Member Author

what about adding a slash command /remove-gist messageId for now?

u need messageId to delete the message also u need gistId to delete the gist

the messageId is provided in the command after getting the messageId u can get the message by using MessageChannel.retrieveMessageById(messageId), after getting the Message u can use Message.getButtons() to get all the buttons on that message and from there u can get the Button(linking to the gist) use the Button.getUrl() method to get its url and u can get the id from that, then delete the gist

delete the message after that too if u want to or u can just disable the button, i prefer deleting the message(to keep the chat clutter free)

only sender of file + mods should have rights to use that command?

@Taz03
Copy link
Member

Taz03 commented Aug 15, 2022

what about adding a slash command /remove-gist messageId for now?

also u can take message link and get the messageId from it, the reason for using message link over message id can be that for copying message id of a message u need to turn on developer mode on in discord settings, and some new users might not have that turned on so it'll save some time solving the "no copy id button" problem

@Taz03
Copy link
Member

Taz03 commented Aug 15, 2022

only sender of file + mods should have rights to use that command?

yes, tho im not sure about heavy mod or soft mod

@Zabuzard
Copy link
Member

soft mod is fine for that

@Zabuzard
Copy link
Member

Anyways, I would like to wrap this up as it is for now, get it shipped and then work on deletion in a separate PR, that okay for you @SquidXTV ?

Long-living and big branches can be problematic to mantain, better ship smaller units. And mods can always manually delete gists by logging in to the bot account anyways.

@SquidXTV
Copy link
Member Author

Anyways, I would like to wrap this up as it is for now, get it shipped and then work on deletion in a separate PR, that okay for you @SquidXTV ?

Long-living and big branches can be problematic to mantain, better ship smaller units. And mods can always manually delete gists by logging in to the bot account anyways.

ok no problem for me, gonna work on your pr comments and then I think it's done for this pr.

Taz03
Taz03 previously approved these changes Aug 16, 2022
@Taz03 Taz03 requested a review from Zabuzard August 17, 2022 07:49
Taz03
Taz03 previously approved these changes Aug 18, 2022
@Zabuzard Zabuzard merged commit 617eb81 into Together-Java:develop Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

auto upload files like .txt/.java/.gradle to a paste website like paste.gg
5 participants