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

As a hackathon hacker I want team channels created for me in Discord automatically #5281

Closed
alexvotofuture opened this issue Sep 29, 2019 · 27 comments
Assignees
Labels
Gitcoin Hackathon Gitcoin Hackathon

Comments

@alexvotofuture
Copy link
Contributor

User Story

As a hackathon hacker I want to have a Discord team channel created for me automatically when I "Start Work" on a prize.

Why Is this Needed

Hackathon participants often need a real-time communication channel for coordinating with potential and active teammates, and need a place to ask sponsors project-specific details.

The Gitcoin team currently uses Discord to provide these communication channels for hackers. However, all channels must be manually created by Gitcoin administrators, since there's no link between "Start Work" instances and the Discord server.

Description

Type: Feature

Current Behavior

Discord servers are manually created by Gitcoin administrators. Administrators periodically check hackathon prize pages for new "Start Work" instances, then create a Discord team channel for the user who started work for every new instance. They invite this user to their team channel according to the Discord username they provide in the "Start Work" work plan form (a field recently added by @owocki).

Gitcoin administrators make the Discord team channel public by default. This allows hackers to invite collaborators easily. But some hackers prefer private channels; in these cases an administrator will simply convert the public channel to a private channel, allowing Gitcoin administrators/ambassadors and sponsors to see messages but will block other hackers from seeing them.

Expected Behavior

When a user clicks "Start Work" on a hackathon prize bounty a public Discord channel should be automatically created and the user that started work should be invited to/tagged in the channel.

Ideally, the "Work Plan" should be automatically pasted to the channel as a message or channel description, so that other hackathon participants/sponsors/administrators can see the project summary/approach within Discord and decide whether to get involved.

Definition of Done

Discord team channels are automatically created when someone hits "Start Work".

Should provide permissions and simple documentation to help Gitcoin administrators use and enable/disable/configure the tool.

Data Requirements

Additional Information

@alexvotofuture
Copy link
Contributor Author

alexvotofuture commented Sep 29, 2019

cc @owocki @vs77bb @kuhnchris @octavioamu @frankchen07 @mul1sh for input on how to approach this

@mul1sh
Copy link
Contributor

mul1sh commented Oct 2, 2019

@alexvotofuture awesome thanks for this , i'm fixing a tough bug for the other discord bot issue, but i'll definitely be done with it tomorrow. So if this is bountied up I can get it done by Friday without further delays, thanks.

@kuhnchris
Copy link
Contributor

@mul1sh you're making your own bot, or do you just create the interface for getting an signal when the start work occoured? thanks

@mul1sh
Copy link
Contributor

mul1sh commented Oct 3, 2019

@kuhnchris i'll create a bot that will do the above, its much easier to implement it this way. But i'll also add instructions for the gitcoin team on how to deploy the bot to discord so as to achieve the above.

@kuhnchris
Copy link
Contributor

It's no problem, i'm just asking the other way around, since we do have a bot already (no problem about a 2nd one tho), the question is how you implement the call to the "outside" from the Start Work button. Do you hardcode a URL to a webserver running paralell to the bot? Do you connect the bot to the database of gitcoin? using some signals?

Let me know, since this is security technically relevant as we do not want to dig ourselves a huge hole for a new feature. :-)

Thanks

@mul1sh
Copy link
Contributor

mul1sh commented Oct 3, 2019

@kuhnchris great questions, 😃

  1. No i'll not hardcode a URL to a webserver
  2. No the bot will not connect to the gitcoin database

Essentially what will happen is, if the issue is a gitcoin hackathon issue and the user already has saved their discord username details and they click start work, then the discord bot will be called with the details of the issue and the user and then from there be able to create the DM.

Also btw I can still reuse the existing gitcoin discord bot, all I have to do is update it to work as above.

@kuhnchris
Copy link
Contributor

I... honestly do not care, that's @alexvotofuture 's call which bot(s) to use.

The essential is clear, but the point why this PR/Issue exists is, that I current do not see myself how the communication should work without hardcoding the start-work right now. If you got it to work, please let me know, i'll check the PR, eager to learn with what method you come up. :-)

Thanks!

@frankchen07
Copy link
Contributor

I believe @kuhnchris is working on this? (I'll let him chime in here)

I'll add another constraint - there seems to be a 50 chat room limit that we'll have to bypass somewhere as well.

@kuhnchris
Copy link
Contributor

@frankchen07 as noted above @mul1sh seems to be working on it, so I'll let him finish for now. The 50 rooms limit shouldn't matter that much - but we can always split the categories - or allow the bot to create new categories if the ones we use are being filled up - e.a. if there are 40 channels in the category we create a new category and switch to that one (giving us about 10 rooms time incase there are lots of people trying to attempt to start).

Alternatively: Create a queue in the database and until all channels are created successfully (via a callback or a reply) you keep sending the channels in the queue via cronjob.

Just some options - i'll leave it to @mul1sh and @alexvotofuture to come up with the solution they want to use for now.

@mul1sh how's the progress? You said something about friday being ready with the above topics - how's it looking?

Thanks!

@mul1sh
Copy link
Contributor

mul1sh commented Oct 21, 2019

@kuhnchris sorry for the delay, been a bit busy on my end. But i've resumed working on this issue and will get it done by Wednesday, so thats it available for use before the next hackathon.

Maybe you could also bounty it up @alexvotofuture @frankchen07 @kuhnchris for some bit of motivation 😃

@gitcoinbot
Copy link
Member

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 0.4 ETH (69.17 USD @ $172.92/ETH) attached to it as part of the Gitcoin fund.

@frankchen07
Copy link
Contributor

@mul1sh - just bountied and reserved for you for 3 days. looking forward to it: https://gitcoin.co/issue/gitcoinco/web/5281/3572

@mul1sh
Copy link
Contributor

mul1sh commented Oct 21, 2019

@frankchen07 wooh thanks, a draft PR is coming up in a bit 😄

@mul1sh
Copy link
Contributor

mul1sh commented Oct 28, 2019

@frankchen07 @alexvotofuture Sorry for the delay in this, I've realised the flow required to make this happen is a bit complex because of the following,

  1. We'll need to create a discord bot and then manually authorise it to run on the Gitcoin Events discord server with the necessary create guild channel permissions.
  2. When a funder creates an hackathon bounty, they should add a short stub for the bounty i.e. bounty-xxx so that this stub can be used later to create the DM channel. They should also manually authorise the gitcoin discord bot to get their access token so that its used for creating group DM's later.
  3. Then when a gitcoin user applies for the hackathon bounty, on clicking submit the page checks to see if the user discord access token is present and if not, they are also prompted to authorise the bot so that it gets this token.
  4. Once the gitcoin user's discord access token is present , then on clicking submit the gitcoin bot is called to do the following
  • The bot auto-creates a discord group dm using the stub, created by the funder above + the gitcoin user's discord name, using the gitcoin user's access token i.e. bounty-xxx-discord-username
  • Then it auto-adds the bounty funder to the discord group dm using their access token.
  1. Finally for each group DM create, the bot will check if the max number of channels under a category has been exceeded and if it has, it will create a new category and repeat step 4.

I managed to get steps 1 done, but the rest are quite complex and will need alot of time for testing so I wanted to get your feedback on this before I proceed any further.

Sadly this also means this functionality won't be ready for the web3 hackathon because I'll need like a month to get it right, so maybe we postpone it to the next hackathon.

Kindly let me know what you think of this, thanks.

@kuhnchris
Copy link
Contributor

uh... al you need is a http part of the bot running in the same script as the bot (for example discord.py + flask) - whenever a new bounty is created with hackathon flag set then we send it to the http-part of the bot and this then creates a new channel (guild->createChannel) and a new role.

The createChannel and role part is already done in this repo:
https://github.com/kuhnchris/discord-event-bot-gitcoinco

All that is missing is the cross-link between gitcoin.co and the bot, either hardcoded (for now) or via a model + admin site.

I'll leave futher discussion up to @alexvotofuture tho.

Thanks,
Chris

@mul1sh
Copy link
Contributor

mul1sh commented Oct 29, 2019

@kuhnchris Sorry I don't get you, creating the channel is not the issue, the issue getting the access tokens for both the hackathon funder and the gitcoin/discord user inorder to add them to the group dm.

Without these tokens, then the bot can auto-create these channels but it won't be able to add the respective user's.

@frankchen07
Copy link
Contributor

Seems there's a little bit of misunderstanding here? I have a couple of questions, perhaps it'll clear things up:

  1. What is this "stub" from the funder and where does it go?

  2. This stub is used to create the room, along with access tokens from both the sponsor and the user, so the room is created + the two users. It sounds like Kuhn Chris is saying that the createChannel and role part is already done. What is the "role part" and does that correlate at all with the access tokens of the sponsor and the user?

@kuhnchris
Copy link
Contributor

@mul1sh sorry about my confusion but:

  • why do you need an access token?
    the only thing you need to know is the discord user, which we store on the database already (User or Profile) - which would be enough (user#xxxx) to add them to the role, if they are in the discord server already. alternatively: you can create an invite link to that channel and give it to that person.
    Also, which group DM?

You have a token for the static discord server on the bot already (the one you joined the bot with) - with that token you can login to the discord server and have the guild with access to create channels and invites.

Or am I misunderstanding our problem?

Thanks

@frankchen07
1.) no idea where you got the "stub" part from
2.) basically: the visiblilty of a channel can be bound to a role. so if you create a "private" channel you need to create a channel, a role and assign the channel the new role and deny "everyone"-role the permissions to see the channel.
Example:
userA creates a bounty for BountyA, so the bot should go to discord, create in the gitcoin server a new channel '#bountyA-userA' and only gives the permission to userA's discord which is set on gitcoin.co, or create an invite shown to userA on gitcoin, and the Sponsors + Gitcoin Team. And for that reason the bot needs to create a role 'bountyA-userA-Role' and gives the channel '#bountyA-UserA' the permission for the role 'bountyA-userA-Role', 'Gitcoin Sponsors' and 'Gitcoin Team'.

Thanks!

@frankchen07
Copy link
Contributor

@mul1sh - do you have a response to @kuhnchris?

@kuhnchris

stub

When a funder creates an hackathon bounty, they should add a short stub for the bounty i.e. bounty-xxx so that this stub can be used later to create the DM channel. They should also manually authorise the gitcoin discord bot to get their access token so that its used for creating group DM's later.

The bot auto-creates a discord group dm using the stub, created by the funder above + the gitcoin user's discord name, using the gitcoin user's access token i.e. bounty-xxx-discord-username

access token

It sounds like there's a disagreement on if the access token is necessary to automatically create a channel.

@mul1sh
Copy link
Contributor

mul1sh commented Nov 6, 2019

@frankchen07 no it's quite o.k i'm the one who got everything mixed up from the docs, sorry for this but @kuhnchris explanation cleared up things. So will this ready & tested by Monday then 🙂

@alexvotofuture
Copy link
Contributor Author

@mul1sh: Is the solution ready and tested? We really need this feature deployed in time for our next hackathon in December.

Let us know if you still think you're able to do it. Thanks!

@mul1sh
Copy link
Contributor

mul1sh commented Nov 14, 2019

@alexvotofuture its almost there, sorry for the delay been a bit busy at work.

But i'll get this in latest over the weekend once i'm done testing on my end.

@alexvotofuture
Copy link
Contributor Author

alexvotofuture commented Nov 26, 2019

@mul1sh Can you make the PR tonight? If not we need to have someone else start on this tomorrow to make it in time for our Dec 2nd launch. Thanks!

@mul1sh
Copy link
Contributor

mul1sh commented Nov 26, 2019

Sorry let me stop working on this ,for now, so that it doesn't seem i'm blocking it. But still i'll push my changes once the docker issue is fixed and i'm able to test my changes locally. Thanks.

@gitcoinbot
Copy link
Member

gitcoinbot commented Dec 3, 2019

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 2 weeks, 4 days from now.
Please review their action plans below:

1) solexplorer has started work.

I have worked on a POC to create channels automatically for discord here: https://github.com/Solexplorer/Hackathoner

Learn more on the Gitcoin Issue Details page.

@gitcoinbot
Copy link
Member

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 0.4 ETH (59.09 USD @ $147.72/ETH) has been submitted by:

  1. @solexplorer

@frankchen07 please take a look at the submitted work:


@gitcoinbot
Copy link
Member

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


The funding of 0.4 ETH (59.09 USD @ $147.72/ETH) attached to this issue has been approved & issued to @Solexplorer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gitcoin Hackathon Gitcoin Hackathon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants