Decode84/Astro

Discord server templates

Closed this issue · 2 comments

The initial setup process of Discord servers. This should make a template for a discord server available for the user.

The idea is this:

  1. Projectowner/whoever wants to add the discord server gets directed to the first link being a server template for example https://discord.new/dQCDNNwCPuhE
  2. Then the server owner confirms to create the server using the template and can close down the webtab
  3. Now he needs to add the server to the project hub to do this the bot needs to be added via a link example: https://discord.com/api/oauth2/authorize?client_id=959004457205637131&permissions=2684611713&redirect_uri=http%3A%2F%2Flocalhost%3A3000&scope=bot%20applications.commands (link describes all the permisions the bot needs)
  4. Neither the create server template link nor the add bot link can connect the discordserver and our webapp/discordbot. This can be solved in 2 ways:
    4.a We need to authenticate at least the projectowner/whoever added the bot on the website with discord. This is done by a simple OAuth request which can be handled entirely between client side and discord. After auth the client can send it's own clientid/clienttoken in a POST request. A guide for that here: https://github.com/discordjs/guide/tree/main/code-samples/oauth/simple-oauth-webserver https://discordjs.guide/oauth2/#getting-started-with-oauth2 (remember to setup redirect for auth). Now the discordbot can fetch the user adding it to the server and the user can provide it's userid on the ProjectHub and thus the bot can be connected to a project. In the start we can just assume that the person only wants to add discord to it's newest project, but later on we need to give the user a choice which project the server can be added to.
    4.b Alternatively we could provide the UUID for the project and then the user can type a command in discord to connect the server and the projecthub. Something like /connect 7wad8d7wd78-7ywd7-dw7 and the user can quickly copy-paste this into the discord server.
    Both 5.a and 5.b makes sense. The benefit of 5.a is provide proper authentication and if you're authenticated on the webserver the bot will always recognize the user if the user adds the bot to more discordservers allowing for many projects to be created quicker in the long run. The benefit of 5.b is that it is more intuitive to do for the user, we need to store less in the database and no need to worry about multiple projects for the same user. On 5.b it will however never get easier to setup discord.
  5. There might be a little prework needed for webhook so that the discordbot have a main TextChannel to work in.

Quick afterthought after writing this: We could seperate the option of creating a server into 2 seperate options: create discordserver from template, connect discordserver to a specific project. This is so that if the user already has their own defined discordserver they can add the bot to that one

The idea is this:
~

This is 🔥